lkml.org 
[lkml]   [2021]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: rtl8188eu: Replace a custom function with crc32_le()
Hi "Fabio,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]

url: https://github.com/0day-ci/linux/commits/Fabio-M-De-Francesco/staging-rtl8188eu-Replace-a-custom-function-with-crc32_le/20210701-213922
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 77ad1f0e99bd00af024e650b862cfda3137af660
config: powerpc64-randconfig-s032-20210709 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/c296b1e11db85710adc1831c4cdb2295192e447f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Fabio-M-De-Francesco/staging-rtl8188eu-Replace-a-custom-function-with-crc32_le/20210701-213922
git checkout c296b1e11db85710adc1831c4cdb2295192e447f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/staging/rtl8188eu/core/rtw_security.c:597:58: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] @@ got unsigned int @@
drivers/staging/rtl8188eu/core/rtw_security.c:597:58: sparse: expected restricted __le32 [usertype]
drivers/staging/rtl8188eu/core/rtw_security.c:597:58: sparse: got unsigned int
drivers/staging/rtl8188eu/core/rtw_security.c:604:58: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] @@ got unsigned int @@
drivers/staging/rtl8188eu/core/rtw_security.c:604:58: sparse: expected restricted __le32 [usertype]
drivers/staging/rtl8188eu/core/rtw_security.c:604:58: sparse: got unsigned int
drivers/staging/rtl8188eu/core/rtw_security.c:671:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] @@ got unsigned int @@
drivers/staging/rtl8188eu/core/rtw_security.c:671:42: sparse: expected restricted __le32 [usertype]
drivers/staging/rtl8188eu/core/rtw_security.c:671:42: sparse: got unsigned int

vim +597 drivers/staging/rtl8188eu/core/rtw_security.c

544
545 /* The hlen isn't include the IV */
546 u32 rtw_tkip_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)
547 { /* exclude ICV */
548 u16 pnl;
549 u32 pnh;
550 u8 rc4key[16];
551 u8 ttkey[16];
552 u8 crc[4];
553 u8 hw_hdr_offset = 0;
554 struct arc4context mycontext;
555 int curfragnum, length;
556
557 u8 *pframe, *payload, *iv, *prwskey;
558 union pn48 dot11txpn;
559 struct sta_info *stainfo;
560 struct pkt_attrib *pattrib = &pxmitframe->attrib;
561 struct security_priv *psecuritypriv = &padapter->securitypriv;
562 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
563 u32 res = _SUCCESS;
564
565 if (!pxmitframe->buf_addr)
566 return _FAIL;
567
568 hw_hdr_offset = TXDESC_SIZE +
569 (pxmitframe->pkt_offset * PACKET_OFFSET_SZ);
570 pframe = pxmitframe->buf_addr + hw_hdr_offset;
571 /* 4 start to encrypt each fragment */
572 if (pattrib->encrypt == _TKIP_) {
573 if (pattrib->psta)
574 stainfo = pattrib->psta;
575 else
576 stainfo = rtw_get_stainfo(&padapter->stapriv, &pattrib->ra[0]);
577
578 if (stainfo) {
579 if (is_multicast_ether_addr(pattrib->ra))
580 prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
581 else
582 prwskey = &stainfo->dot118021x_UncstKey.skey[0];
583
584 for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
585 iv = pframe + pattrib->hdrlen;
586 payload = pframe + pattrib->iv_len + pattrib->hdrlen;
587
588 GET_TKIP_PN(iv, dot11txpn);
589
590 pnl = (u16)(dot11txpn.val);
591 pnh = (u32)(dot11txpn.val >> 16);
592 phase1((u16 *)&ttkey[0], prwskey, &pattrib->ta[0], pnh);
593 phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl);
594
595 if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */
596 length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
> 597 *((__le32 *)crc) = ~crc32_le(~0, payload, length);
598
599 arcfour_init(&mycontext, rc4key, 16);
600 arcfour_encrypt(&mycontext, payload, payload, length);
601 arcfour_encrypt(&mycontext, payload + length, crc, 4);
602 } else {
603 length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
604 *((__le32 *)crc) = ~crc32_le(~0, payload, length);
605
606 arcfour_init(&mycontext, rc4key, 16);
607 arcfour_encrypt(&mycontext, payload, payload, length);
608 arcfour_encrypt(&mycontext, payload + length, crc, 4);
609
610 pframe += pxmitpriv->frag_len;
611 pframe = (u8 *)round_up((size_t)(pframe), 4);
612 }
613 }
614 } else {
615 res = _FAIL;
616 }
617 }
618 return res;
619 }
620

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-07-10 02:27    [W:1.058 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site