The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Steve French <smfrench@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cifs: avoid mixing bool and le16
Date: Fri, 25 Jul 2008 19:25:10 +0100	[thread overview]
Message-ID: <20080725182510.GL28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1216857138.30386.33.camel@brick>

On Wed, Jul 23, 2008 at 04:52:18PM -0700, Harvey Harrison wrote:
> fs/cifs/cifssmb.c:3917:13: warning: incorrect type in assignment (different base types)
> fs/cifs/cifssmb.c:3917:13:    expected bool [unsigned] [usertype] is_unicode
> fs/cifs/cifssmb.c:3917:13:    got restricted __le16
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>

It's a sparse bug - the thing doesn't treat conversions to bool right.

FWIW, if you want an obviously broken case, consider

char a[2 * (bool)2 - 1];

It *should* turn into

char a[1];

What happens instead is that bool is treated as 1-bit unsigned integer
type, resulting in char a[-1].

So we need to fix that crap; the real rules are simple - conversion of
any arithmetic or pointer type to _Bool behaves as if we had v != 0;
same as for if/while/do/for conditions.

      parent reply	other threads:[~2008-07-25 18:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-23 23:52 [PATCH] cifs: avoid mixing bool and le16 Harvey Harrison
2008-07-24  0:19 ` Steve French
2008-07-24  0:24   ` Harvey Harrison
2008-07-24  0:26     ` Steve French
2008-07-25 18:25 ` Al Viro [this message]

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=20080725182510.GL28946@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=smfrench@gmail.com \
    /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