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:
 <PN0P287MB28432411CBC8CAE2C443E74CFF742@PN0P287MB2843.INDP287.PROD.OUTLOOK.COM>
Date: Sat, 28 Sep 2024 06:11:54 +0000
From: Hardevsinh Palaniya <hardevsinh.palaniya@...iconsignals.io>
To: Frank Li <Frank.li@....com>
CC: "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
	"olteanv@...il.com" <olteanv@...il.com>, "broonie@...nel.org"
	<broonie@...nel.org>, Han Xu <han.xu@....com>, Shawn Guo
	<shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>, Pengutronix
 Kernel Team <kernel@...gutronix.de>, Fabio Estevam <festevam@...il.com>,
	Haibo Chen <haibo.chen@....com>, Yogesh Gaur <yogeshgaur.83@...il.com>,
	"imx@...ts.linux.dev" <imx@...ts.linux.dev>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 2/4] spi: spi-fsl-qspi: Fix casting warnings

Hi Frank,

Thanks for the suggestions

>>       if (!q->devtype_data->little_endian)
>> -             mask = (u32)cpu_to_be32(mask);
>> +             mask =(__force u32)cpu_to_be32(mask);
>
>Most this kind warning report the real problem. I don't suggest fix as it

I’m curious about the types of real problems that might arise

>the 'if branch' should be removed.
>
>and simple
>
>return read_poll_timeout(qspi_readl, reg, !(reg & mask), delay_us, timeout_us,
>                         q, base);
>
>qspi_readl() already handle endian problem.

I agree , it is a good approach since qspi_readl() already handles the endian issue 

I will change it to your approach.

>
>Frank

Best Regards,
Hardev

________________________________________
From: Frank Li <Frank.li@....com>
Sent: Friday, September 27, 2024 9:10 PM
To: Hardevsinh Palaniya <hardevsinh.palaniya@...iconsignals.io>
Cc: linux-spi@...r.kernel.org <linux-spi@...r.kernel.org>; olteanv@...il.com <olteanv@...il.com>; broonie@...nel.org <broonie@...nel.org>; Han Xu <han.xu@....com>; Shawn Guo <shawnguo@...nel.org>; Sascha Hauer <s.hauer@...gutronix.de>; Pengutronix Kernel Team <kernel@...gutronix.de>; Fabio Estevam <festevam@...il.com>; Haibo Chen <haibo.chen@....com>; Yogesh Gaur <yogeshgaur.83@...il.com>; imx@...ts.linux.dev <imx@...ts.linux.dev>; linux-kernel@...r.kernel.org <linux-kernel@...r.kernel.org>; linux-arm-kernel@...ts.infradead.org <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 2/4] spi: spi-fsl-qspi: Fix casting warnings
 
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

On Fri, Sep 27, 2024 at 06:58:33PM +0530, Hardevsinh Palaniya wrote:
> Sparse warnings:
>
> drivers/spi/spi-fsl-qspi.c:635:25: warning: cast from restricted __be32
>
> Signed-off-by: Hardevsinh Palaniya <hardevsinh.palaniya@...iconsignals.io>
> ---
>  drivers/spi/spi-fsl-qspi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> index 79bac30e79af..e4a2a6049e33 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -632,7 +632,7 @@ static int fsl_qspi_readl_poll_tout(struct fsl_qspi *q, void __iomem *base,
>       u32 reg;
>
>       if (!q->devtype_data->little_endian)
> -             mask = (u32)cpu_to_be32(mask);
> +             mask =(__force u32)cpu_to_be32(mask);

Most this kind warning report the real problem. I don't suggest fix as it

the 'if branch' should be removed.

and simple

return read_poll_timeout(qspi_readl, reg, !(reg & mask), delay_us, timeout_us,
                         q, base);

qspi_readl() already handle endian problem.

Frank

>
>       return readl_poll_timeout(base, reg, !(reg & mask), delay_us,
>                                 timeout_us);
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ