Re: [PATCH] rtw_security: fix cast to restricted __le32

From: Greg KH
Date: Sun Jun 13 2021 - 06:27:16 EST


On Sun, Jun 13, 2021 at 06:22:29PM +0800, Jhih-Ming Huang wrote:
> This patch fixes the sparse warning of fix cast to restricted __le32.
>
> Signed-off-by: Jhih-Ming Huang <fbihjmeric@xxxxxxxxx>
> ---
> drivers/staging/rtl8723bs/core/rtw_security.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> index a99f439328f1..2f4da67e31c6 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> @@ -121,7 +121,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
> arc4_crypt(ctx, payload, payload, length);
>
> /* calculate icv and compare the icv */
> - *((u32 *)crc) = le32_to_cpu(~crc32_le(~0, payload, length - 4));
> + *((u32 *)crc) = le32_to_cpu((__force __le32)~crc32_le(~0, payload, length - 4));

When you use __force, that usually implies something is wrong here.

Look at the recent changes that were just submitted for this a week or
so ago in the mailing list archives, and the discussion about them, to
see the issues involved here.

I would need to see a _LOT_ of description in the changelog about why
these changes are actually correct, before I can take them.

thanks,

greg k-h