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:   Mon, 4 Jan 2021 16:42:07 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Alexandru Ardelean <alexandru.ardelean@...log.com>
Cc:     linux-spi <linux-spi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Mark Brown <broonie@...nel.org>,
        Stephen Rothwell <sfr@...b.auug.org.au>
Subject: Re: [PATCH v2] spi: stm32: update dev_dbg() print format for SPI params

On Mon, Jan 4, 2021 at 4:27 PM Alexandru Ardelean
<alexandru.ardelean@...log.com> wrote:
>
> With the introduction of the 'include/uapi/linux/spi/spi.h' header, the
> type of the macros are enforced to 'unsigned long int' via the _BITUL()
> macro.
>
> This causes some -Wformat warnings in the spi-stm32 driver.
> This patch adds a double-negation operator to the bit-masks. Essentially,
> the important values for debugging are 0 or 1, while masking them directly
> would show 0 or BIT(x) values.
> This way, the type of the arguments are automatically re-cast.

Thanks!
Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Fixes: f7005142dace ("spi: uapi: unify SPI modes into a single spi.h header")
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Stephen Rothwell <sfr@...b.auug.org.au>
> Cc: Andy Shevchenko <andy.shevchenko@...il.com>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> ---
>
> Changelog v1 -> v2:
> * revert to using '%d' specifiers
> * add !! operatior to bit-masking; this way the types are automatically
>   re-cast
> * add 'Reported-by: kernel test robot <lkp@...el.com>'
>
>  drivers/spi/spi-stm32.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
> index 6017209c6d2f..be0fb169d7a7 100644
> --- a/drivers/spi/spi-stm32.c
> +++ b/drivers/spi/spi-stm32.c
> @@ -1028,10 +1028,10 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
>                 clrb |= spi->cfg->regs->lsb_first.mask;
>
>         dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
> -               spi_dev->mode & SPI_CPOL,
> -               spi_dev->mode & SPI_CPHA,
> -               spi_dev->mode & SPI_LSB_FIRST,
> -               spi_dev->mode & SPI_CS_HIGH);
> +               !!(spi_dev->mode & SPI_CPOL),
> +               !!(spi_dev->mode & SPI_CPHA),
> +               !!(spi_dev->mode & SPI_LSB_FIRST),
> +               !!(spi_dev->mode & SPI_CS_HIGH));
>
>         spin_lock_irqsave(&spi->lock, flags);
>
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ