lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 29 Oct 2022 19:34:26 +0200 (CEST)
From:   Julia Lawall <julia.lawall@...ia.fr>
To:     Deepak R Varma <drv@...lo.com>
cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        outreachy@...ts.linux.dev, dri-devel@...ts.freedesktop.org,
        linux-fbdev@...r.kernel.org, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: fbtft: Use ARRAY_SIZE() to get argument count



On Sat, 29 Oct 2022, Deepak R Varma wrote:

> On Sat, Oct 29, 2022 at 09:32:50AM +0200, Greg Kroah-Hartman wrote:
> > On Fri, Oct 28, 2022 at 07:00:05PM +0530, Deepak R Varma wrote:
> > > The ARRAY_SIZE(foo) macro should be preferred over sizeof operator
> > > based computation such as sizeof(foo)/sizeof(foo[0]) for finding
> > > number of elements in an array. Issue identified using coccicheck.
> > >
> > > Signed-off-by: Deepak R Varma <drv@...lo.com>
> > > ---
> > >  drivers/staging/fbtft/fbtft.h | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> > > index 2c2b5f1c1df3..5506a473be91 100644
> > > --- a/drivers/staging/fbtft/fbtft.h
> > > +++ b/drivers/staging/fbtft/fbtft.h
> > > @@ -231,7 +231,7 @@ struct fbtft_par {
> > >  	bool polarity;
> > >  };
> > >
> > > -#define NUMARGS(...)  (sizeof((int[]){__VA_ARGS__}) / sizeof(int))
> > > +#define NUMARGS(...)  ARRAY_SIZE(((int[]){ __VA_ARGS__ }))
> >
> > Please please please test-build your patches before sending them out.
> > To not do so just wastes reviewer resources :(
>
> Hello Greg,
> I did build the .ko files by making the driver/staging/fbtft/ path. I verified
> .o and .ko files were built.
>
> I did a make clean just now and was again able to rebuild without any errors.
> Please see the attached log file.
>
> Is there something wrong with the way I am firing the build?

The change is in the definition of a macro.  The compiler won't help you
in this case unless the macro is actually used in code that is compiled.
Find the uses and check for any nearby ifdefs.  For file foo.c you can
also do make foo.i to see the result of reducing ifdef and expanding
macros.  Then you can see if the code you changed is actually included in
the build.

julia

Powered by blists - more mailing lists