public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	Akinobu Mita <akinobu.mita@gmail.com>,
	Tony Luck <tony.luck@intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	kbuild test robot <lkp@intel.com>
Subject: [PATCH v1] x86/gdt: Replace u16 castings by bitwise & in GDT_ENTRY_INIT()
Date: Tue,  2 Jun 2020 12:19:41 +0300	[thread overview]
Message-ID: <20200602091941.29449-1-andriy.shevchenko@linux.intel.com> (raw)

It appears that the original commit 1e5de18278e6
("x86: Introduce GDT_ENTRY_INIT()") used bitwise operations on the parameters
when the commit 38e9e81f4c81 ("x86/gdt: Use bitfields for initialization")
changed them to simple castings. The latter change recently made sparse not
happy about. To satisfy it return to bitwise operations in GDT_ENTRY_INIT().

Fixes: 38e9e81f4c81 ("x86/gdt: Use bitfields for initialization")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/include/asm/desc_defs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/desc_defs.h b/arch/x86/include/asm/desc_defs.h
index a91f3b6e4f2a..0d17a86fc1df 100644
--- a/arch/x86/include/asm/desc_defs.h
+++ b/arch/x86/include/asm/desc_defs.h
@@ -22,9 +22,9 @@ struct desc_struct {
 
 #define GDT_ENTRY_INIT(flags, base, limit)			\
 	{							\
-		.limit0		= (u16) (limit),		\
+		.limit0		= ((limit) >> 0) & 0xFFFF,	\
 		.limit1		= ((limit) >> 16) & 0x0F,	\
-		.base0		= (u16) (base),			\
+		.base0		= ((base) >> 0) & 0xFFFF,	\
 		.base1		= ((base) >> 16) & 0xFF,	\
 		.base2		= ((base) >> 24) & 0xFF,	\
 		.type		= (flags & 0x0f),		\
-- 
2.27.0.rc2


                 reply	other threads:[~2020-06-02  9:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200602091941.29449-1-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=akinobu.mita@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox