Skip to contentSkip to conversation

x86: Get rid of 'dubious one-bit signed bitfield' sprase warning

PATCH In review Anton Vorontsov 2 participants 3 messages Jan 11, 2012 – Jan 16, 2012 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: Get rid of 'dubious one-bit signed bitfield' sprase warning

This very noisy sparse warning appears on almost every file in the kernel:

CHECK init/main.c
arch/x86/include/asm/thread_info.h:43:55: error: dubious one-bit signed bitfield arch/x86/include/asm/thread_info.h:44:46: error: dubious one-bit signed bitfield

This patch changes sig_on_uaccess_error and uaccess_err flags to unsigned type and thus fixes the warning.

---

Not sure why this warning is still there, as it spams the build process a lot. I googled some discussion dated month ago... but no one sent a patch?

http://www.spinics.net/lists/linux-kernel-janitors/msg10172.html

I went safest way, i.e. changing types to unsigned instead of bool/__u8.

 arch/x86/include/asm/thread_info.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/thread_info.h +2 -2
index 7404715..bc817cd 100644
@@ -40,8 +40,8 @@ struct thread_info {
 						*/
 	__u8			supervisor_stack[0];
 #endif
-	int			sig_on_uaccess_error:1;
-	int			uaccess_err:1;	/* uaccess failed */
+	unsigned int		sig_on_uaccess_error:1;
+	unsigned int		uaccess_err:1;	/* uaccess failed */
 };
 
 #define INIT_THREAD_INFO(tsk)			\
Signature · 1 line
1.7.7.3
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Anton Vorontsov

This very noisy sparse warning appears on almost every file in the kernel:

 CHECK   init/main.c
arch/x86/include/asm/thread_info.h:43:55: error: dubious one-bit signed bitfield arch/x86/include/asm/thread_info.h:44:46: error: dubious one-bit signed bitfield

Quoted 5 lines

This patch changes sig_on_uaccess_error and uaccess_err flags to unsigned type and thus fixes the warning.

---

This structure isn't used by userspace (or not usefully, anyway -- it's not at all stable across releases).

--Andy

#2 lore raw

[tip:x86/urgent] x86: Get rid of dubious one-bit signed bitfield

In reply to Anton Vorontsov
Commit-ID:  f10448689d95b9516c656ccd4078839e656656e7
Gitweb:     http://git.kernel.org/tip/f10448689d95b9516c656ccd4078839e656656e7
Author:     Anton Vorontsov <[email protected]>
AuthorDate: Wed, 11 Jan 2012 05:11:46 +0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 16 Jan 2012 09:39:54 +0100

x86: Get rid of dubious one-bit signed bitfield

This very noisy sparse warning appears on almost every file in the kernel:

CHECK init/main.c
arch/x86/include/asm/thread_info.h:43:55: error: dubious one-bit signed bitfield arch/x86/include/asm/thread_info.h:44:46: error:
dubious one-bit signed bitfield

Sparse is right and this patch changes sig_on_uaccess_error and uaccess_err flags to unsigned type and thus fixes the warning.

---
 arch/x86/include/asm/thread_info.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/thread_info.h +2 -2
index 185b719..56a63ff 100644
@@ -40,8 +40,8 @@ struct thread_info {
 						*/
 	__u8			supervisor_stack[0];
 #endif
-	int			sig_on_uaccess_error:1;
-	int			uaccess_err:1;	/* uaccess failed */
+	unsigned int		sig_on_uaccess_error:1;
+	unsigned int		uaccess_err:1;	/* uaccess failed */
 };
 
 #define INIT_THREAD_INFO(tsk)			\