|
Message-ID: <201907020931.2170BAB@keescook> Date: Tue, 2 Jul 2019 09:33:02 -0700 From: Kees Cook <keescook@...omium.org> To: Joe Perches <joe@...ches.com> Cc: Alexey Dobriyan <adobriyan@...il.com>, Andreas Dilger <adilger@...ger.ca>, Andrew Morton <akpm@...ux-foundation.org>, Shyam Saini <shyam.saini@...rulasolutions.com>, kernel-hardening@...ts.openwall.com, linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org, linux-mips@...r.kernel.org, intel-gvt-dev@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org, netdev@...r.kernel.org, linux-ext4 <linux-ext4@...r.kernel.org>, devel@...ts.orangefs.org, linux-mm@...ck.org, linux-sctp@...r.kernel.org, bpf@...r.kernel.org, kvm@...r.kernel.org, mayhs11saini@...il.com Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro On Sat, Jun 29, 2019 at 09:45:10AM -0700, Joe Perches wrote: > On Sat, 2019-06-29 at 17:25 +0300, Alexey Dobriyan wrote: > > On Tue, Jun 11, 2019 at 03:00:10PM -0600, Andreas Dilger wrote: > > > On Jun 11, 2019, at 2:48 PM, Andrew Morton <akpm@...ux-foundation.org> wrote: > > > > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini <shyam.saini@...rulasolutions.com> wrote: > > > I did a check, and FIELD_SIZEOF() is used about 350x, while sizeof_field() > > > is about 30x, and SIZEOF_FIELD() is only about 5x. > > > > > > That said, I'm much more in favour of "sizeof_field()" or "sizeof_member()" > > > than FIELD_SIZEOF(). Not only does that better match "offsetof()", with > > > which it is closely related, but is also closer to the original "sizeof()". > > > > > > Since this is a rather trivial change, it can be split into a number of > > > patches to get approval/landing via subsystem maintainers, and there is no > > > huge urgency to remove the original macros until the users are gone. It > > > would make sense to remove SIZEOF_FIELD() and sizeof_field() quickly so > > > they don't gain more users, and the remaining FIELD_SIZEOF() users can be > > > whittled away as the patches come through the maintainer trees. > > > > The signature should be > > > > sizeof_member(T, m) > > > > it is proper English, > > it is lowercase, so is easier to type, > > it uses standard term (member, not field), > > it blends in with standard "sizeof" operator, > > yes please. > > Also, a simple script conversion applied > immediately after an rc1 might be easiest > rather than individual patches. This seems reasonable to me. I think the patch steps would be: 1) implement sizeof_member(T, m) as a stand-alone macro 2) do a scripted replacement of all identical macros. 3) remove all the identical macros. Step 2 can be a patch that includes the script used to do the replacement. That way Linus can choose to just run the script instead of taking the patch. -- Kees Cook
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.