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]
Message-ID: <CAKwvOdm9+UEXCepJGDzjNibYTss5joek-3FMC6K2Z7w1EPLdGQ@mail.gmail.com>
Date:   Wed, 6 Jul 2022 13:30:59 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc:     kernel test robot <lkp@...el.com>, llvm@...ts.linux.dev,
        kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Lars-Peter Clausen <lars@...afoo.de>
Subject: Re: drivers/iio/adc/ad7476.c:29:8: warning: Excessive padding in
 'struct ad7476_chip_info' (10 padding bytes, where 2 is optimal). Optimal
 fields order: reset, channel, convst_channel, int_vref_uv, has_vref,
 has_vdrive, consider reordering the fields or addin...

On Wed, Jul 6, 2022 at 5:45 AM Jonathan Cameron
<Jonathan.Cameron@...wei.com> wrote:
>
>
>
> >    Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
> >    21 warnings generated.
> > >> drivers/iio/adc/ad7476.c:29:8: warning: Excessive padding in 'struct ad7476_chip_info' (10 padding bytes, where 2 is optimal). Optimal fields order: reset, channel, convst_channel, int_vref_uv, has_vref, has_vdrive, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
> >    struct ad7476_chip_info {
> >    ~~~~~~~^~~~~~~~~~~~~~~~~~
> >    drivers/iio/adc/ad7476.c:29:8: note: Excessive padding in 'struct ad7476_chip_info' (10 padding bytes, where 2 is optimal). Optimal fields order: reset, channel, convst_channel, int_vref_uv, has_vref, has_vdrive, consider reordering the fields or adding explicit padding members
> >    struct ad7476_chip_info {
> >    ~~~~~~~^~~~~~~~~~~~~~~~~~
> > >> drivers/iio/adc/ad7476.c:39:8: warning: Excessive padding in 'struct ad7476_state' (472 padding bytes, where 216 is optimal). Optimal fields order: data, spi, chip_info, ref_reg, convst_gpio, msg, xfer, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
> >    struct ad7476_state {
>
> For this one and I'm guessing some of the other IIO cases, if there is any way to suppress the warning where we have specific
> alignments specified then that would be great. These are padded to ensure the buffers are DMA safe.

I didn't see anything during a quick scan of:
https://github.com/llvm/llvm-project/blob/main/clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp#L73
to disable this warning when it's a false positive.

Though
https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics
mentions NOLINT.

>
> Thanks,
>
> Jonathan
>
>
> >    ~~~~~~~^~~~~~~~~~~~~~
> >    drivers/iio/adc/ad7476.c:39:8: note: Excessive padding in 'struct ad7476_state' (472 padding bytes, where 216 is optimal). Optimal fields order: data, spi, chip_info, ref_reg, convst_gpio, msg, xfer, consider reordering the fields or adding explicit padding members
> >    struct ad7476_state {
> >    ~~~~~~~^~~~~~~~~~~~~~
> >    Suppressed 19 warnings (7 in non-user code, 12 with check filters).
> >    Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
> >    20 warnings generated.
> >    drivers/iio/adc/ad7766.c:35:8: warning: Excessive padding in 'struct ad7766' (392 padding bytes, where 136 is optimal). Optimal fields order: data, chip_info, spi, mclk, pd_gpio, trig, reg, msg, xfer, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
> >    struct ad7766 {
> >    ~~~~~~~^~~~~~~~
> >    drivers/iio/adc/ad7766.c:35:8: note: Excessive padding in 'struct ad7766' (392 padding bytes, where 136 is optimal). Optimal fields order: data, chip_info, spi, mclk, pd_gpio, trig, reg, msg, xfer, consider reordering the fields or adding explicit padding members
> >    struct ad7766 {
> >    ~~~~~~~^~~~~~~~
> >    Suppressed 19 warnings (7 in non-user code, 12 with check filters).
> >    Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
> >    20 warnings generated.
> >    drivers/iio/adc/ad7768-1.c:154:8: warning: Excessive padding in 'struct ad7768_state' (388 padding bytes, where 132 is optimal). Optimal fields order: data, mclk_freq, spi, vref, mclk, trig, gpio_sync_in, labels, lock, completion, samp_freq, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
> >    struct ad7768_state {
> >    ~~~~~~~^~~~~~~~~~~~~~
> >    drivers/iio/adc/ad7768-1.c:154:8: note: Excessive padding in 'struct ad7768_state' (388 padding bytes, where 132 is optimal). Optimal fields order: data, mclk_freq, spi, vref, mclk, trig, gpio_sync_in, labels, lock, completion, samp_freq, consider reordering the fields or adding explicit padding members
> >    struct ad7768_state {
> >    ~~~~~~~^~~~~~~~~~~~~~
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ