Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1671206

Re: [PATCH] kernel.h: fix new warnings for container_of()

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH] kernel.h: fix new warnings for container_of()
Date 2017-06-21 00:50 +0200
Message-ID <tUA89-69h-13@gated-at.bofh.it> (permalink)
References <tUxN1-4P5-35@gated-at.bofh.it> <tUA89-69h-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jun 20, 2017 at 3:43 PM, Kees Cook <keescook@chromium.org> wrote:
> On Tue, Jun 20, 2017 at 1:09 PM, Arnd Bergmann <arnd@arndb.de> wrote:
>> I see new warnings with gcc-7.0.1 with the modified container_of():
>>
>> fs/f2fs/dir.c: In function 'F2FS_I':
>> fs/f2fs/f2fs.h:1122:385: note: found mismatched ssa struct pointer types: 'struct f2fs_inode_info' and 'struct inode'
>
> This is actually from the randstruct plugin, not native gcc. I'll go
> update the message reporting to include a "randstruct: " which should
> make this more obvious.
>
>> This seems to happen for all structures that have a zero offset
>> between the member and the container structure, i.e. idential
>> pointers.
>>
>> Reverting to an intermediate pointer avoids the warning, and using
>> a void pointer instead of the target type should also avoid
>> regressing on the previous patch again.
>>
>> Fixes: mmotm ("kernel.h: handle pointers to arrays better in container_of()")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Thanks!
>
> I'll take this into the kspp tree so all the fixes are in the same place.

Oh, nevermind, I see the Fixes is for what's already in -mm. :) And I
see akpm picked this up already. Sorry for the noise!

-Kees

-- 
Kees Cook
Pixel Security

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] kernel.h: fix new warnings for container_of() Arnd Bergmann <arnd@arndb.de> - 2017-06-20 22:20 +0200
  Re: [PATCH] kernel.h: fix new warnings for container_of() Kees Cook <keescook@chromium.org> - 2017-06-21 00:50 +0200
  Re: [PATCH] kernel.h: fix new warnings for container_of() Kees Cook <keescook@chromium.org> - 2017-06-21 00:50 +0200
  Re: [PATCH] kernel.h: fix new warnings for container_of() Ian Abbott <abbotti@mev.co.uk> - 2017-06-21 11:30 +0200
    Re: [PATCH] kernel.h: fix new warnings for container_of() Arnd Bergmann <arnd@arndb.de> - 2017-06-21 12:20 +0200

csiph-web