tree:
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next
head: b9f38e913a926b455e5048a95f53a993b515509f
commit: 1b11e893eda0907fc9b28696271e2d9c4337e42d [201/268] staging: rtl8723bs: replace
private arc4 encryption with in-kernel one
config: powerpc64-randconfig-r011-20210520 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
bf9ef3efaa99c02e7bfc4c57207301b8de39a278)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
#
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit...
git remote add staging
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
git fetch --no-tags staging staging-next
git checkout 1b11e893eda0907fc9b28696271e2d9c4337e42d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro
'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:126:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/staging/rtl8723bs/core/rtw_security.c:8:
In file included from drivers/staging/rtl8723bs/include/drv_types.h:20:
In file included from drivers/staging/rtl8723bs/include/osdep_service.h:15:
In file included from drivers/staging/rtl8723bs/include/osdep_service_linux.h:19:
In file included from include/linux/netdevice.h:37:
In file included from include/net/net_namespace.h:38:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro
'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:128:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/staging/rtl8723bs/core/rtw_security.c:8:
In file included from drivers/staging/rtl8723bs/include/drv_types.h:20:
In file included from drivers/staging/rtl8723bs/include/osdep_service.h:15:
In file included from drivers/staging/rtl8723bs/include/osdep_service_linux.h:19:
In file included from include/linux/netdevice.h:37:
In file included from include/net/net_namespace.h:38:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro
'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:130:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/staging/rtl8723bs/core/rtw_security.c:8:
In file included from drivers/staging/rtl8723bs/include/drv_types.h:20:
In file included from drivers/staging/rtl8723bs/include/osdep_service.h:15:
In file included from drivers/staging/rtl8723bs/include/osdep_service_linux.h:19:
In file included from include/linux/netdevice.h:37:
In file included from include/net/net_namespace.h:38:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro
'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:132:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/staging/rtl8723bs/core/rtw_security.c:8:
In file included from drivers/staging/rtl8723bs/include/drv_types.h:20:
In file included from drivers/staging/rtl8723bs/include/osdep_service.h:15:
In file included from drivers/staging/rtl8723bs/include/osdep_service_linux.h:19:
In file included from include/linux/netdevice.h:37:
In file included from include/net/net_namespace.h:38:
In file included from include/linux/skbuff.h:31:
In file included from include/linux/dma-mapping.h:10:
In file included from include/linux/scatterlist.h:9:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a
null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro
'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:134:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
> drivers/staging/rtl8723bs/core/rtw_security.c:89:6: warning:
stack frame size of 1120 bytes in function 'rtw_wep_encrypt'
[-Wframe-larger-than=]
void rtw_wep_encrypt(struct adapter *padapter, u8
*pxmitframe)
^
> drivers/staging/rtl8723bs/core/rtw_security.c:145:6: warning:
stack frame size of 1088 bytes in function 'rtw_wep_decrypt'
[-Wframe-larger-than=]
void rtw_wep_decrypt(struct adapter *padapter, u8
*precvframe)
^
> drivers/staging/rtl8723bs/core/rtw_security.c:514:5: warning:
stack frame size of 1136 bytes in function 'rtw_tkip_encrypt'
[-Wframe-larger-than=]
u32 rtw_tkip_encrypt(struct adapter *padapter, u8
*pxmitframe)
^
> drivers/staging/rtl8723bs/core/rtw_security.c:586:5: warning:
stack frame size of 1104 bytes in function 'rtw_tkip_decrypt'
[-Wframe-larger-than=]
u32 rtw_tkip_decrypt(struct adapter *padapter, u8
*precvframe)
^
10 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MAC80211_LEDS
Depends on NET && WIRELESS && MAC80211 && (LEDS_CLASS ||
LEDS_CLASS
Selected by
- CARL9170_LEDS && NETDEVICES && WLAN && WLAN_VENDOR_ATH
&& CARL9170
vim +/rtw_wep_encrypt +89 drivers/staging/rtl8723bs/core/rtw_security.c
554c0a3abf216c9 Hans de Goede 2017-03-29 84
554c0a3abf216c9 Hans de Goede 2017-03-29 85
554c0a3abf216c9 Hans de Goede 2017-03-29 86 /*
554c0a3abf216c9 Hans de Goede 2017-03-29 87 Need to consider the fragment situation
554c0a3abf216c9 Hans de Goede 2017-03-29 88 */
554c0a3abf216c9 Hans de Goede 2017-03-29 @89 void rtw_wep_encrypt(struct adapter
*padapter, u8 *pxmitframe)
554c0a3abf216c9 Hans de Goede 2017-03-29 90 { /* exclude ICV */
554c0a3abf216c9 Hans de Goede 2017-03-29 91
554c0a3abf216c9 Hans de Goede 2017-03-29 92 unsigned char crc[4];
1b11e893eda0907 Fabio Aiuto 2021-05-07 93 struct arc4_ctx mycontext;
554c0a3abf216c9 Hans de Goede 2017-03-29 94
d495c5503d1339c Marco Cesati 2021-03-12 95 signed int curfragnum, length;
554c0a3abf216c9 Hans de Goede 2017-03-29 96 u32 keylength;
554c0a3abf216c9 Hans de Goede 2017-03-29 97
554c0a3abf216c9 Hans de Goede 2017-03-29 98 u8 *pframe, *payload, *iv; /* wepkey
*/
554c0a3abf216c9 Hans de Goede 2017-03-29 99 u8 wepkey[16];
554c0a3abf216c9 Hans de Goede 2017-03-29 100 u8 hw_hdr_offset = 0;
554c0a3abf216c9 Hans de Goede 2017-03-29 101 struct pkt_attrib *pattrib = &((struct
xmit_frame *)pxmitframe)->attrib;
554c0a3abf216c9 Hans de Goede 2017-03-29 102 struct security_priv *psecuritypriv =
&padapter->securitypriv;
554c0a3abf216c9 Hans de Goede 2017-03-29 103 struct xmit_priv *pxmitpriv =
&padapter->xmitpriv;
554c0a3abf216c9 Hans de Goede 2017-03-29 104
554c0a3abf216c9 Hans de Goede 2017-03-29 105 if (((struct xmit_frame
*)pxmitframe)->buf_addr == NULL)
554c0a3abf216c9 Hans de Goede 2017-03-29 106 return;
554c0a3abf216c9 Hans de Goede 2017-03-29 107
554c0a3abf216c9 Hans de Goede 2017-03-29 108 hw_hdr_offset = TXDESC_OFFSET;
554c0a3abf216c9 Hans de Goede 2017-03-29 109 pframe = ((struct xmit_frame
*)pxmitframe)->buf_addr + hw_hdr_offset;
554c0a3abf216c9 Hans de Goede 2017-03-29 110
554c0a3abf216c9 Hans de Goede 2017-03-29 111 /* start to encrypt each fragment */
554c0a3abf216c9 Hans de Goede 2017-03-29 112 if ((pattrib->encrypt == _WEP40_) ||
(pattrib->encrypt == _WEP104_)) {
554c0a3abf216c9 Hans de Goede 2017-03-29 113 keylength =
psecuritypriv->dot11DefKeylen[psecuritypriv->dot11PrivacyKeyIndex];
554c0a3abf216c9 Hans de Goede 2017-03-29 114
554c0a3abf216c9 Hans de Goede 2017-03-29 115 for (curfragnum = 0; curfragnum <
pattrib->nr_frags; curfragnum++) {
554c0a3abf216c9 Hans de Goede 2017-03-29 116 iv = pframe+pattrib->hdrlen;
554c0a3abf216c9 Hans de Goede 2017-03-29 117 memcpy(&wepkey[0], iv, 3);
554c0a3abf216c9 Hans de Goede 2017-03-29 118 memcpy(&wepkey[3],
&psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],
keylength);
554c0a3abf216c9 Hans de Goede 2017-03-29 119 payload =
pframe+pattrib->iv_len+pattrib->hdrlen;
554c0a3abf216c9 Hans de Goede 2017-03-29 120
554c0a3abf216c9 Hans de Goede 2017-03-29 121 if ((curfragnum+1) ==
pattrib->nr_frags) { /* the last fragment */
554c0a3abf216c9 Hans de Goede 2017-03-29 122
554c0a3abf216c9 Hans de Goede 2017-03-29 123 length =
pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
554c0a3abf216c9 Hans de Goede 2017-03-29 124
554c0a3abf216c9 Hans de Goede 2017-03-29 125 *((__le32 *)crc) = getcrc32(payload,
length);
554c0a3abf216c9 Hans de Goede 2017-03-29 126
1b11e893eda0907 Fabio Aiuto 2021-05-07 127 arc4_setkey(&mycontext, wepkey, 3 +
keylength);
1b11e893eda0907 Fabio Aiuto 2021-05-07 128 arc4_crypt(&mycontext, payload,
payload, length);
1b11e893eda0907 Fabio Aiuto 2021-05-07 129 arc4_crypt(&mycontext, payload +
length, crc, 4);
554c0a3abf216c9 Hans de Goede 2017-03-29 130
554c0a3abf216c9 Hans de Goede 2017-03-29 131 } else {
554c0a3abf216c9 Hans de Goede 2017-03-29 132 length =
pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
554c0a3abf216c9 Hans de Goede 2017-03-29 133 *((__le32 *)crc) = getcrc32(payload,
length);
1b11e893eda0907 Fabio Aiuto 2021-05-07 134 arc4_setkey(&mycontext, wepkey, 3 +
keylength);
1b11e893eda0907 Fabio Aiuto 2021-05-07 135 arc4_crypt(&mycontext, payload,
payload, length);
1b11e893eda0907 Fabio Aiuto 2021-05-07 136 arc4_crypt(&mycontext, payload +
length, crc, 4);
554c0a3abf216c9 Hans de Goede 2017-03-29 137
554c0a3abf216c9 Hans de Goede 2017-03-29 138 pframe += pxmitpriv->frag_len;
87fe08d74ca66d8 Ross Schmidt 2020-10-03 139 pframe = (u8
*)round_up((SIZE_PTR)(pframe), 4);
554c0a3abf216c9 Hans de Goede 2017-03-29 140 }
554c0a3abf216c9 Hans de Goede 2017-03-29 141 }
554c0a3abf216c9 Hans de Goede 2017-03-29 142 }
554c0a3abf216c9 Hans de Goede 2017-03-29 143 }
554c0a3abf216c9 Hans de Goede 2017-03-29 144
554c0a3abf216c9 Hans de Goede 2017-03-29 @145 void rtw_wep_decrypt(struct adapter
*padapter, u8 *precvframe)
554c0a3abf216c9 Hans de Goede 2017-03-29 146 {
554c0a3abf216c9 Hans de Goede 2017-03-29 147 /* exclude ICV */
554c0a3abf216c9 Hans de Goede 2017-03-29 148 u8 crc[4];
1b11e893eda0907 Fabio Aiuto 2021-05-07 149 struct arc4_ctx mycontext;
d495c5503d1339c Marco Cesati 2021-03-12 150 signed int length;
554c0a3abf216c9 Hans de Goede 2017-03-29 151 u32 keylength;
554c0a3abf216c9 Hans de Goede 2017-03-29 152 u8 *pframe, *payload, *iv, wepkey[16];
554c0a3abf216c9 Hans de Goede 2017-03-29 153 u8 keyindex;
554c0a3abf216c9 Hans de Goede 2017-03-29 154 struct rx_pkt_attrib *prxattrib =
&(((union recv_frame *)precvframe)->u.hdr.attrib);
554c0a3abf216c9 Hans de Goede 2017-03-29 155 struct security_priv *psecuritypriv =
&padapter->securitypriv;
554c0a3abf216c9 Hans de Goede 2017-03-29 156
554c0a3abf216c9 Hans de Goede 2017-03-29 157 pframe = (unsigned char *)((union
recv_frame *)precvframe)->u.hdr.rx_data;
554c0a3abf216c9 Hans de Goede 2017-03-29 158
554c0a3abf216c9 Hans de Goede 2017-03-29 159 /* start to decrypt recvframe */
554c0a3abf216c9 Hans de Goede 2017-03-29 160 if ((prxattrib->encrypt == _WEP40_) ||
(prxattrib->encrypt == _WEP104_)) {
554c0a3abf216c9 Hans de Goede 2017-03-29 161 iv = pframe+prxattrib->hdrlen;
554c0a3abf216c9 Hans de Goede 2017-03-29 162 /* keyindex =(iv[3]&0x3); */
554c0a3abf216c9 Hans de Goede 2017-03-29 163 keyindex = prxattrib->key_index;
554c0a3abf216c9 Hans de Goede 2017-03-29 164 keylength =
psecuritypriv->dot11DefKeylen[keyindex];
554c0a3abf216c9 Hans de Goede 2017-03-29 165 memcpy(&wepkey[0], iv, 3);
554c0a3abf216c9 Hans de Goede 2017-03-29 166 /* memcpy(&wepkey[3],
&psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],
keylength); */
554c0a3abf216c9 Hans de Goede 2017-03-29 167 memcpy(&wepkey[3],
&psecuritypriv->dot11DefKey[keyindex].skey[0], keylength);
554c0a3abf216c9 Hans de Goede 2017-03-29 168 length = ((union recv_frame
*)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
554c0a3abf216c9 Hans de Goede 2017-03-29 169
554c0a3abf216c9 Hans de Goede 2017-03-29 170 payload =
pframe+prxattrib->iv_len+prxattrib->hdrlen;
554c0a3abf216c9 Hans de Goede 2017-03-29 171
554c0a3abf216c9 Hans de Goede 2017-03-29 172 /* decrypt payload include icv */
1b11e893eda0907 Fabio Aiuto 2021-05-07 173 arc4_setkey(&mycontext, wepkey, 3 +
keylength);
1b11e893eda0907 Fabio Aiuto 2021-05-07 174 arc4_crypt(&mycontext, payload,
payload, length);
554c0a3abf216c9 Hans de Goede 2017-03-29 175
554c0a3abf216c9 Hans de Goede 2017-03-29 176 /* calculate icv and compare the icv */
554c0a3abf216c9 Hans de Goede 2017-03-29 177 *((u32 *)crc) =
le32_to_cpu(getcrc32(payload, length-4));
554c0a3abf216c9 Hans de Goede 2017-03-29 178
554c0a3abf216c9 Hans de Goede 2017-03-29 179 }
554c0a3abf216c9 Hans de Goede 2017-03-29 180 }
554c0a3abf216c9 Hans de Goede 2017-03-29 181
:::::: The code at line 89 was first introduced by commit
:::::: 554c0a3abf216c991c5ebddcdb2c08689ecd290b staging: Add rtl8723bs sdio wifi driver
:::::: TO: Hans de Goede <hdegoede(a)redhat.com>
:::::: CC: Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org