Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-07-02 Thread Kees Cook
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 > > > wrote: > > > > On Wed, 12 Jun 2019 01:08:36 +0530

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-29 Thread Joe Perches
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 > > wrote: > > > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini > > > wrote: > > I did a check, and FIELD_SIZEOF() is used

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-29 Thread Alexey Dobriyan
On Tue, Jun 11, 2019 at 03:00:10PM -0600, Andreas Dilger wrote: > On Jun 11, 2019, at 2:48 PM, Andrew Morton wrote: > > > > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini > > wrote: > I did a check, and FIELD_SIZEOF() is used about 350x, while sizeof_field() > is about 30x, and SIZEOF_FIELD()

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Alexei Starovoitov
On Tue, Jun 11, 2019 at 5:00 PM Shyam Saini wrote: > > Currently, there are 3 different macros, namely sizeof_field, SIZEOF_FIELD > and FIELD_SIZEOF which are used to calculate the size of a member of > structure, so to bring uniformity in entire kernel source tree lets use > FIELD_SIZEOF and

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Shyam Saini
Hi Andrew, > > On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > > > >> to FIELD_SIZEOF > > > > > > As Alexey has pointed out, C structs and unions don't have fields - > > > they have members. So this is an opportunity to switch everything to > > > a new member_sizeof(). > > > > > >

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Andreas Dilger
On Jun 11, 2019, at 3:09 PM, Andrew Morton wrote: > > On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > to FIELD_SIZEOF >>> >>> As Alexey has pointed out, C structs and unions don't have fields - >>> they have members. So this is an opportunity to switch everything to >>> a new

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Andrew Morton
On Tue, 11 Jun 2019 15:00:10 -0600 Andreas Dilger wrote: > >> to FIELD_SIZEOF > > > > As Alexey has pointed out, C structs and unions don't have fields - > > they have members. So this is an opportunity to switch everything to > > a new member_sizeof(). > > > > What do people think of that

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Shyam Saini
Hi Kees, Cc'ing William Kucharski, > On Wed, Jun 12, 2019 at 01:08:36AM +0530, Shyam Saini wrote: > > In favour of FIELD_SIZEOF, this patch also deprecates other two similar > > macros sizeof_field and SIZEOF_FIELD. > > > > For code compatibility reason, retain sizeof_field macro as a wrapper

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Andreas Dilger
On Jun 11, 2019, at 2:48 PM, Andrew Morton wrote: > > On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini > wrote: > >> Currently, there are 3 different macros, namely sizeof_field, SIZEOF_FIELD >> and FIELD_SIZEOF which are used to calculate the size of a member of >> structure, so to bring

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Andrew Morton
On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini wrote: > Currently, there are 3 different macros, namely sizeof_field, SIZEOF_FIELD > and FIELD_SIZEOF which are used to calculate the size of a member of > structure, so to bring uniformity in entire kernel source tree lets use > FIELD_SIZEOF and

Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Kees Cook
On Wed, Jun 12, 2019 at 01:08:36AM +0530, Shyam Saini wrote: > In favour of FIELD_SIZEOF, this patch also deprecates other two similar > macros sizeof_field and SIZEOF_FIELD. > > For code compatibility reason, retain sizeof_field macro as a wrapper macro > to FIELD_SIZEOF Can you explain this

[PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro

2019-06-11 Thread Shyam Saini
Currently, there are 3 different macros, namely sizeof_field, SIZEOF_FIELD and FIELD_SIZEOF which are used to calculate the size of a member of structure, so to bring uniformity in entire kernel source tree lets use FIELD_SIZEOF and replace all occurrences of other two macros with this. For this