From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch -next] x86: dubious one-bit signed bitfields
Date: Wed, 07 Dec 2011 07:58:46 +0000 [thread overview]
Message-ID: <20111207075846.GH3236@mwanda> (raw)
In-Reply-To: <20111207063848.GA14507@elgon.mountain>
[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]
On Tue, Dec 06, 2011 at 11:39:31PM -0800, H. Peter Anvin wrote:
> On 12/06/2011 10:38 PM, Dan Carpenter wrote:
> > It doesn't cause any runtime problems in this case, but bitfields should
> > be unsigned. This file gets included a lot so it generates thousands of
> > Sparse warnings about dubious one-bit signed bitfields.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
> > index 0ecd1a9..114dca1 100644
> > --- a/arch/x86/include/asm/thread_info.h
> > +++ b/arch/x86/include/asm/thread_info.h
> > @@ -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 */
> > };
> >
>
> Can bitfields legally be declared "bool"? If so it's probably the right
> thing, really...
Sure. Bool takes one byte, so it would be:
bool sig_on_uaccess_error:1;
bool uaccess_err:1; /* uaccess failed */
The __u8 types mean that we're trying to not polute the posix
namespace? Does that affect bool? I'm not sure the rules with that.
regards,
dan carpenter
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-12-07 7:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 6:38 [patch -next] x86: dubious one-bit signed bitfields Dan Carpenter
2011-12-07 7:39 ` H. Peter Anvin
2011-12-07 7:58 ` Dan Carpenter [this message]
2011-12-07 18:14 ` H. Peter Anvin
2011-12-15 13:45 ` Dan Carpenter
2011-12-15 16:38 ` Andy Lutomirski
2011-12-15 17:06 ` Dan Carpenter
2012-01-04 6:41 ` Dan Carpenter
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=20111207075846.GH3236@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.