[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YOIGbc2ymnWrThVK@kroah.com>
Date: Sun, 4 Jul 2021 21:05:17 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Jhih-Ming Huang <fbihjmeric@...il.com>
Cc: fabioaiuto83@...il.com, ross.schm.dev@...il.com,
maqianga@...ontech.com, marcocesati@...il.com,
linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v7] rtw_security: fix cast to restricted __le32
On Sun, Jul 04, 2021 at 06:31:12PM +0800, Jhih-Ming Huang wrote:
> This patch fixes the sparse warning of fix cast to restricted __le32.
>
> There was a change for replacing private CRC-32 routines with in kernel
> ones.
> However, the author used le32_to_cpu to convert crc32_le(), and we
> should use cpu_to_le32.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Jhih-Ming Huang <fbihjmeric@...il.com>
> ---
> drivers/staging/rtl8723bs/core/rtw_security.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
> index a99f439328f1..ff79e1aacd1a 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_security.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_security.c
> @@ -92,7 +92,6 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
> void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
> {
> /* exclude ICV */
> - u8 crc[4];
> signed int length;
> u32 keylength;
> u8 *pframe, *payload, *iv, wepkey[16];
> @@ -119,10 +118,6 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
> /* decrypt payload include icv */
> arc4_setkey(ctx, wepkey, 3 + keylength);
> arc4_crypt(ctx, payload, payload, length);
> -
> - /* calculate icv and compare the icv */
> - *((u32 *)crc) = le32_to_cpu(~crc32_le(~0, payload, length - 4));
> -
> }
> }
>
> @@ -537,7 +532,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
> u32 pnh;
> u8 rc4key[16];
> u8 ttkey[16];
> - u8 crc[4];
> + __le32 crc;
> signed int length;
>
> u8 *pframe, *payload, *iv, *prwskey;
> @@ -618,10 +613,9 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
> arc4_setkey(ctx, rc4key, 16);
> arc4_crypt(ctx, payload, payload, length);
>
> - *((u32 *)crc) = le32_to_cpu(~crc32_le(~0, payload, length - 4));
> + crc = cpu_to_le32(~crc32_le(~0, payload, length - 4));
>
> - if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] ||
> - crc[1] != payload[length - 3] || crc[0] != payload[length - 4])
> + if (crc != get_unaligned_le32(payload + length - 4))
> res = _FAIL;
> } else {
> res = _FAIL;
> --
> 2.32.0
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/SubmittingPatches for what needs to be done
here to properly describe this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
Powered by blists - more mailing lists