From patchwork Wed Oct 21 07:40:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Lalancette X-Patchwork-Id: 55057 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9L7fB8u032702 for ; Wed, 21 Oct 2009 07:41:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752735AbZJUHlF (ORCPT ); Wed, 21 Oct 2009 03:41:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752849AbZJUHlF (ORCPT ); Wed, 21 Oct 2009 03:41:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62432 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752387AbZJUHlD (ORCPT ); Wed, 21 Oct 2009 03:41:03 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9L7eWqu000865; Wed, 21 Oct 2009 03:40:32 -0400 Received: from localhost.localdomain (vpn-12-41.rdu.redhat.com [10.11.12.41]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9L7eU9m003167; Wed, 21 Oct 2009 03:40:30 -0400 From: Chris Lalancette To: mingo@redhat.com Cc: x86@kernel.org, kvm@vger.kernel.org, pbonzini@redhat.com, Chris Lalancette Subject: [PATCH] Make sure get_user_desc() doesn't sign extend. Date: Wed, 21 Oct 2009 09:40:29 +0200 Message-Id: <1256110829-4188-1-git-send-email-clalance@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h index e8de2f6..617bd56 100644 --- a/arch/x86/include/asm/desc.h +++ b/arch/x86/include/asm/desc.h @@ -288,7 +288,7 @@ static inline void load_LDT(mm_context_t *pc) static inline unsigned long get_desc_base(const struct desc_struct *desc) { - return desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24); + return (unsigned)(desc->base0 | ((desc->base1) << 16) | ((desc->base2) << 24)); } static inline void set_desc_base(struct desc_struct *desc, unsigned long base)