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] [day] [month] [year] [list]
Date:   Wed, 8 Jul 2020 07:34:47 +0100
From:   Lee Jones <lee.jones@...aro.org>
To:     Joe Perches <joe@...ches.com>
Cc:     gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Thomas Winischhofer <thomas@...ischhofer.net>
Subject: Re: [PATCH 04/30] usb: misc: sisusbvga: sisusb_init: Mark all
 'static const' arrays as __maybe_unused

On Tue, 07 Jul 2020, Joe Perches wrote:

> On Tue, 2020-07-07 at 09:03 +0100, Lee Jones wrote:
> > On Fri, 03 Jul 2020, Joe Perches wrote:
> > 
> > > On Fri, 2020-07-03 at 18:41 +0100, Lee Jones wrote:
> > > > drivers/usb/misc/sisusbvga/sisusb_init.h is included by a few
> > > > source files.  Most of which do not use the majority of the
> > > > shared static const arrays which have been declared.  This
> > > > causes the build system to spew 100's of warnings.
> > > > 
> > > > Fixes the following W=1 kernel build warning(s) - and a whole lot more:
> > > > 
> > > >  In file included from drivers/usb/misc/sisusbvga/sisusb.c:54:
> > > >  drivers/usb/misc/sisusbvga/sisusb_init.h:695:34: warning: ‘SiSUSB_VCLKData’ defined but not used [-Wunused-const-variable=]
> > > >  695 | static const struct SiS_VCLKData SiSUSB_VCLKData[] = {
> > > >  | ^~~~~~~~~~~~~~~
> > > > [10's of lines snipped]
> > > >  drivers/usb/misc/sisusbvga/sisusb_init.h:206:28: warning: ‘SiS_VGA_DAC’ defined but not used [-Wunused-const-variable=]
> > > >  206 | static const unsigned char SiS_VGA_DAC[] = {
> > > >  | ^~~~~~~~~~~
> > > > [10's of lines snipped]
> > > >  drivers/usb/misc/sisusbvga/sisusb_init.h:171:29: warning: ‘ModeIndex_1280x1024’ defined but not used [-Wunused-const-variable=]
> > > >  171 | static const unsigned short ModeIndex_1280x1024[] = { 0x3a, 0x4d, 0x00, 0x65 };
> > > >  | ^~~~~~~~~~~~~~~~~~~
> > > > [10's of lines snipped]
> > > 
> > > They are not __maybe_unused, they _are_ used.
> > 
> > Actually, it looks like all of the ModeIndex_* table are *not* used,
> > so those will be removed.
> > 
> > > I think these instead should be moved to where
> > > they are used instead of being declared in an
> > > #include file.
> > 
> > The remaining tables are many and large, so stuffing them into the
> > source file does not seem like the correct thing to do.
> 
> It the right thing to do is because otherwise they
> would be duplicated.  Either declare them only in
> the single file where use or declare them extern
> and define them only in one place.

I refuse to dump 700 lines of nonsensical cruft (data) into a
source file.  No one wants to parse through that in any C file they
maintain/operate on.

Not sure I understand why they would be duplicated.  The *-tables.h
header file will only be included by the 1 source file that makes use
of them.  Could you please elaborate?

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ