Re: [PATCH 2/3] staging: rtl8723bs: Use existing arc4 implementation

From: kernel test robot
Date: Sat Apr 10 2021 - 11:26:39 EST


Hi Christophe,

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/Christophe-JAILLET/staging-rtl8188eu-Use-existing-arc4-implementation/20210410-213656
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 32abcac8037da5dc570c22abf266cbb92eee9fc9
config: arm-randconfig-s032-20210410 (attached as .config)
compiler: arm-linux-gnueabi-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-279-g6d5d9b42-dirty
# https://github.com/0day-ci/linux/commit/e0f0911d8f1c282314b6c6df1c03a0656f575f77
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-JAILLET/staging-rtl8188eu-Use-existing-arc4-implementation/20210410-213656
git checkout e0f0911d8f1c282314b6c6df1c03a0656f575f77
# 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=arm

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

All warnings (new ones prefixed by >>):

drivers/staging/rtl8723bs/core/rtw_security.c: In function 'rtw_wep_encrypt':
>> drivers/staging/rtl8723bs/core/rtw_security.c:144:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=]
144 | }
| ^
drivers/staging/rtl8723bs/core/rtw_security.c: In function 'rtw_wep_decrypt':
drivers/staging/rtl8723bs/core/rtw_security.c:181:1: warning: the frame size of 1056 bytes is larger than 1024 bytes [-Wframe-larger-than=]
181 | }
| ^
drivers/staging/rtl8723bs/core/rtw_security.c: In function 'rtw_tkip_encrypt':
drivers/staging/rtl8723bs/core/rtw_security.c:583:1: warning: the frame size of 1088 bytes is larger than 1024 bytes [-Wframe-larger-than=]
583 | }
| ^
drivers/staging/rtl8723bs/core/rtw_security.c: In function 'rtw_tkip_decrypt':
drivers/staging/rtl8723bs/core/rtw_security.c:679:1: warning: the frame size of 1072 bytes is larger than 1024 bytes [-Wframe-larger-than=]
679 | }
| ^


vim +144 drivers/staging/rtl8723bs/core/rtw_security.c

554c0a3abf216c Hans de Goede 2017-03-29 92
554c0a3abf216c Hans de Goede 2017-03-29 93 unsigned char crc[4];
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 94 struct arc4_ctx mycontext;
554c0a3abf216c Hans de Goede 2017-03-29 95
d495c5503d1339 Marco Cesati 2021-03-12 96 signed int curfragnum, length;
554c0a3abf216c Hans de Goede 2017-03-29 97 u32 keylength;
554c0a3abf216c Hans de Goede 2017-03-29 98
554c0a3abf216c Hans de Goede 2017-03-29 99 u8 *pframe, *payload, *iv; /* wepkey */
554c0a3abf216c Hans de Goede 2017-03-29 100 u8 wepkey[16];
554c0a3abf216c Hans de Goede 2017-03-29 101 u8 hw_hdr_offset = 0;
554c0a3abf216c Hans de Goede 2017-03-29 102 struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
554c0a3abf216c Hans de Goede 2017-03-29 103 struct security_priv *psecuritypriv = &padapter->securitypriv;
554c0a3abf216c Hans de Goede 2017-03-29 104 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
554c0a3abf216c Hans de Goede 2017-03-29 105
554c0a3abf216c Hans de Goede 2017-03-29 106 if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
554c0a3abf216c Hans de Goede 2017-03-29 107 return;
554c0a3abf216c Hans de Goede 2017-03-29 108
554c0a3abf216c Hans de Goede 2017-03-29 109 hw_hdr_offset = TXDESC_OFFSET;
554c0a3abf216c Hans de Goede 2017-03-29 110 pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
554c0a3abf216c Hans de Goede 2017-03-29 111
554c0a3abf216c Hans de Goede 2017-03-29 112 /* start to encrypt each fragment */
554c0a3abf216c Hans de Goede 2017-03-29 113 if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) {
554c0a3abf216c Hans de Goede 2017-03-29 114 keylength = psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex];
554c0a3abf216c Hans de Goede 2017-03-29 115
554c0a3abf216c Hans de Goede 2017-03-29 116 for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
554c0a3abf216c Hans de Goede 2017-03-29 117 iv = pframe+pattrib->hdrlen;
554c0a3abf216c Hans de Goede 2017-03-29 118 memcpy(&wepkey[0], iv, 3);
554c0a3abf216c Hans de Goede 2017-03-29 119 memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0], keylength);
554c0a3abf216c Hans de Goede 2017-03-29 120 payload = pframe+pattrib->iv_len+pattrib->hdrlen;
554c0a3abf216c Hans de Goede 2017-03-29 121
554c0a3abf216c Hans de Goede 2017-03-29 122 if ((curfragnum+1) == pattrib->nr_frags) { /* the last fragment */
554c0a3abf216c Hans de Goede 2017-03-29 123
554c0a3abf216c Hans de Goede 2017-03-29 124 length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
554c0a3abf216c Hans de Goede 2017-03-29 125
554c0a3abf216c Hans de Goede 2017-03-29 126 *((__le32 *)crc) = getcrc32(payload, length);
554c0a3abf216c Hans de Goede 2017-03-29 127
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 128 arc4_setkey(&mycontext, wepkey, 3 + keylength);
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 129 arc4_crypt(&mycontext, payload, payload, length);
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 130 arc4_crypt(&mycontext, payload + length, crc, 4);
554c0a3abf216c Hans de Goede 2017-03-29 131
554c0a3abf216c Hans de Goede 2017-03-29 132 } else {
554c0a3abf216c Hans de Goede 2017-03-29 133 length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
554c0a3abf216c Hans de Goede 2017-03-29 134 *((__le32 *)crc) = getcrc32(payload, length);
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 135 arc4_setkey(&mycontext, wepkey, 3 + keylength);
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 136 arc4_crypt(&mycontext, payload, payload, length);
e0f0911d8f1c28 Christophe JAILLET 2021-04-10 137 arc4_crypt(&mycontext, payload + length, crc, 4);
554c0a3abf216c Hans de Goede 2017-03-29 138
554c0a3abf216c Hans de Goede 2017-03-29 139 pframe += pxmitpriv->frag_len;
87fe08d74ca66d Ross Schmidt 2020-10-03 140 pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
554c0a3abf216c Hans de Goede 2017-03-29 141 }
554c0a3abf216c Hans de Goede 2017-03-29 142 }
554c0a3abf216c Hans de Goede 2017-03-29 143 }
554c0a3abf216c Hans de Goede 2017-03-29 @144 }
554c0a3abf216c Hans de Goede 2017-03-29 145

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip