lkml.org 
[lkml]   [2008]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cifs: avoid mixing bool and le16
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.


\
 
 \ /
  Last update: 2008-07-25 20:27    [W:0.041 / U:1.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site