[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202205181229.E12F85BBBE@keescook>
Date: Wed, 18 May 2022 13:21:07 -0700
From: Kees Cook <keescook@...omium.org>
To: David Howells <dhowells@...hat.com>
Cc: Jeff Layton <jlayton@...nel.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] netfs: Use container_of() for offset casting
On Wed, May 18, 2022 at 09:05:14AM +0100, David Howells wrote:
> [...]
> I don't want to do the following, say:
>
>
> struct afs_vnode {
> struct netfs_i_c_pair ni;
> ...
> };
>
> as that would then require a lot of s/->vfs_inode/->ni.vfs_inode/, but maybe
> it would be better to include a struct inode in struct netfs_i_context, and
Right; that's why I kept the struct internal -- the implicit ordering of
inode and netfs_i_context is already present in all the users.
> On the other hand:
>
> warthog>git grep '[>.]vfs_inode' -- fs/{9p,afs,ceph,cifs,nfs} | wc -l
> 181
That seems painful. Maybe _new_ users of netfs could be written to use
the proposed netfs_inode:
> so maybe a mass change to, say:
>
> struct netfs_inode {
> struct inode vfs_inode;
> ...
> };
Better yet, netfs can define a macro helper. I'll send a v2...
--
Kees Cook
Powered by blists - more mailing lists