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]
Message-ID: <fd0b4e1736a46a427d980a703fb99b9205bc4f84.camel@siemens.com>
Date:   Fri, 25 Aug 2023 07:17:42 +0000
From:   "Sverdlin, Alexander" <alexander.sverdlin@...mens.com>
To:     "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
        "andriy.shevchenko@...ux.intel.com" 
        <andriy.shevchenko@...ux.intel.com>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     "lukas@...ner.de" <lukas@...ner.de>
Subject: Re: [PATCH v1 3/3] spidev: Simplify SPI_IOC_RD_MODE* cases in
 spidev_ioctl()

Hi!

On Thu, 2023-08-24 at 19:22 +0300, Andy Shevchenko wrote:
> The temporary variable tmp is not used outside of the
> SPI_IOC_RD_MODE* cases, hence we can optimize its use.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Reviewed-by: Lukas Wunner <lukas@...ner.de>

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@...mens.com>

> ---
>  drivers/spi/spidev.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
> index e324b42c658c..c5450217528b 100644
> --- a/drivers/spi/spidev.c
> +++ b/drivers/spi/spidev.c
> @@ -391,17 +391,15 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
>         /* read requests */
>         case SPI_IOC_RD_MODE:
>         case SPI_IOC_RD_MODE32:
> -               tmp = spi->mode;
> +               tmp = spi->mode & SPI_MODE_MASK;
>  
>                 if (ctlr->use_gpio_descriptors && spi_get_csgpiod(spi, 0))
>                         tmp &= ~SPI_CS_HIGH;
>  
>                 if (cmd == SPI_IOC_RD_MODE)
> -                       retval = put_user(tmp & SPI_MODE_MASK,
> -                                         (__u8 __user *)arg);
> +                       retval = put_user(tmp, (__u8 __user *)arg);
>                 else
> -                       retval = put_user(tmp & SPI_MODE_MASK,
> -                                         (__u32 __user *)arg);
> +                       retval = put_user(tmp, (__u32 __user *)arg);
>                 break;
>         case SPI_IOC_RD_LSB_FIRST:
>                 retval = put_user((spi->mode & SPI_LSB_FIRST) ?  1 : 0,

-- 
Alexander Sverdlin
Siemens AG
www.siemens.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ