Re: [PATCH v12, 2/2] net: Add dm9051 driver
by kernel test robot
Hi Joseph,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on 9d922f5df53844228b9f7c62f2593f4f06c0b69b]
url: https://github.com/0day-ci/linux/commits/Joseph-CHAMG/ADD-DM9051-ETHERNET...
base: 9d922f5df53844228b9f7c62f2593f4f06c0b69b
config: arm64-allyesconfig (https://download.01.org/0day-ci/archive/20220121/202201211736.UtU0eL2j-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d4baf3b1322b84816aa623d8e8cb45a49cb68b84)
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 arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/a6eb8dd02aed17af37a0b38fbcc250fd9...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Joseph-CHAMG/ADD-DM9051-ETHERNET-DRIVER/20220121-121713
git checkout a6eb8dd02aed17af37a0b38fbcc250fd9ed9492d
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/net/ethernet/davicom/
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 >>):
>> drivers/net/ethernet/davicom/dm9051.c:1076:26: warning: implicit conversion from 'unsigned long' to 'u32' (aka 'unsigned int') changes value from 18446744073709551613 to 4294967293 [-Wconstant-conversion]
db->mdiobus->phy_mask = ~GENMASK(1, 1);
~ ^~~~~~~~~~~~~~
1 warning generated.
vim +1076 drivers/net/ethernet/davicom/dm9051.c
1062
1063 static int dm9051_mdiobus_register(struct board_info *db)
1064 {
1065 struct spi_device *spi = db->spidev;
1066 int ret;
1067
1068 db->mdiobus = devm_mdiobus_alloc(&spi->dev);
1069 if (!db->mdiobus)
1070 return -ENOMEM;
1071
1072 db->mdiobus->priv = db;
1073 db->mdiobus->read = dm9051_mdiobus_read;
1074 db->mdiobus->write = dm9051_mdiobus_write;
1075 db->mdiobus->name = "dm9051-mdiobus";
> 1076 db->mdiobus->phy_mask = ~GENMASK(1, 1);
1077 db->mdiobus->parent = &spi->dev;
1078 snprintf(db->mdiobus->id, MII_BUS_ID_SIZE,
1079 "dm9051-%s.%u", dev_name(&spi->dev), spi->chip_select);
1080
1081 ret = devm_mdiobus_register(&spi->dev, db->mdiobus);
1082 if (ret) {
1083 dev_err(&spi->dev, "Could not register MDIO bus\n");
1084 return ret;
1085 }
1086 return 0;
1087 }
1088
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
Re: [PATCH] ipv4: fix lock leaks
by kernel test robot
Hi ycaibb,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on net/master horms-ipvs/master linus/master v5.16 next-20220121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/ycaibb/ipv4-fix-lock-leaks/20220...
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8aaaf2f3af2ae212428f4db1af34214225f5cec3
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220121/202201211725.MInieseL-lk...)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/604258c8f5a9792828f54e55769ca1673...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ycaibb/ipv4-fix-lock-leaks/20220121-111241
git checkout 604258c8f5a9792828f54e55769ca1673c4a34ee
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash net/ipv4/
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 >>):
net/ipv4/tcp_ipv4.c: In function 'listening_get_first':
>> net/ipv4/tcp_ipv4.c:2342:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2342 | if (seq_sk_match(seq, sk))
| ^~
net/ipv4/tcp_ipv4.c:2344:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2344 | return sk;
| ^~~~~~
net/ipv4/tcp_ipv4.c: In function 'established_get_first':
net/ipv4/tcp_ipv4.c:2421:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2421 | if (seq_sk_match(seq, sk))
| ^~
net/ipv4/tcp_ipv4.c:2423:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2423 | return sk;
| ^~~~~~
vim +/if +2342 net/ipv4/tcp_ipv4.c
ad2d61376a0517 Martin KaFai Lau 2021-07-01 2321
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2322 /* Find a non empty bucket (starting from st->bucket)
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2323 * and return the first sk from it.
a8b690f98baf9f Tom Herbert 2010-06-07 2324 */
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2325 static void *listening_get_first(struct seq_file *seq)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2326 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2327 struct tcp_iter_state *st = seq->private;
b08d4d3b6c0460 Yonghong Song 2020-06-23 2328
a8b690f98baf9f Tom Herbert 2010-06-07 2329 st->offset = 0;
05c0b35709c58b Martin KaFai Lau 2021-07-01 2330 for (; st->bucket <= tcp_hashinfo.lhash2_mask; st->bucket++) {
05c0b35709c58b Martin KaFai Lau 2021-07-01 2331 struct inet_listen_hashbucket *ilb2;
05c0b35709c58b Martin KaFai Lau 2021-07-01 2332 struct inet_connection_sock *icsk;
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2333 struct sock *sk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2334
05c0b35709c58b Martin KaFai Lau 2021-07-01 2335 ilb2 = &tcp_hashinfo.lhash2[st->bucket];
05c0b35709c58b Martin KaFai Lau 2021-07-01 2336 if (hlist_empty(&ilb2->head))
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2337 continue;
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2338
05c0b35709c58b Martin KaFai Lau 2021-07-01 2339 spin_lock(&ilb2->lock);
05c0b35709c58b Martin KaFai Lau 2021-07-01 2340 inet_lhash2_for_each_icsk(icsk, &ilb2->head) {
05c0b35709c58b Martin KaFai Lau 2021-07-01 2341 sk = (struct sock *)icsk;
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 @2342 if (seq_sk_match(seq, sk))
604258c8f5a979 Ryan Cai 2022-01-21 2343 spin_unlock(&ilb2->lock);
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2344 return sk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2345 }
05c0b35709c58b Martin KaFai Lau 2021-07-01 2346 spin_unlock(&ilb2->lock);
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2347 }
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2348
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2349 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2350 }
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2351
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
Re: [PATCH] ipv4: fix lock leaks
by kernel test robot
Hi ycaibb,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on net/master linus/master v5.16 next-20220121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/ycaibb/ipv4-fix-lock-leaks/20220...
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8aaaf2f3af2ae212428f4db1af34214225f5cec3
config: powerpc-warp_defconfig (https://download.01.org/0day-ci/archive/20220121/202201211710.SKAxSkq3-lk...)
compiler: powerpc-linux-gcc (GCC) 11.2.0
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
# https://github.com/0day-ci/linux/commit/604258c8f5a9792828f54e55769ca1673...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ycaibb/ipv4-fix-lock-leaks/20220121-111241
git checkout 604258c8f5a9792828f54e55769ca1673c4a34ee
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=powerpc SHELL=/bin/bash net/ipv4/
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 >>):
net/ipv4/tcp_ipv4.c: In function 'listening_get_first':
>> net/ipv4/tcp_ipv4.c:2342:25: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2342 | if (seq_sk_match(seq, sk))
| ^~
net/ipv4/tcp_ipv4.c:2344:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2344 | return sk;
| ^~~~~~
net/ipv4/tcp_ipv4.c: In function 'established_get_first':
net/ipv4/tcp_ipv4.c:2421:25: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
2421 | if (seq_sk_match(seq, sk))
| ^~
net/ipv4/tcp_ipv4.c:2423:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
2423 | return sk;
| ^~~~~~
vim +/if +2342 net/ipv4/tcp_ipv4.c
ad2d61376a0517 Martin KaFai Lau 2021-07-01 2321
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2322 /* Find a non empty bucket (starting from st->bucket)
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2323 * and return the first sk from it.
a8b690f98baf9f Tom Herbert 2010-06-07 2324 */
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2325 static void *listening_get_first(struct seq_file *seq)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2326 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2327 struct tcp_iter_state *st = seq->private;
b08d4d3b6c0460 Yonghong Song 2020-06-23 2328
a8b690f98baf9f Tom Herbert 2010-06-07 2329 st->offset = 0;
05c0b35709c58b Martin KaFai Lau 2021-07-01 2330 for (; st->bucket <= tcp_hashinfo.lhash2_mask; st->bucket++) {
05c0b35709c58b Martin KaFai Lau 2021-07-01 2331 struct inet_listen_hashbucket *ilb2;
05c0b35709c58b Martin KaFai Lau 2021-07-01 2332 struct inet_connection_sock *icsk;
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2333 struct sock *sk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2334
05c0b35709c58b Martin KaFai Lau 2021-07-01 2335 ilb2 = &tcp_hashinfo.lhash2[st->bucket];
05c0b35709c58b Martin KaFai Lau 2021-07-01 2336 if (hlist_empty(&ilb2->head))
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2337 continue;
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2338
05c0b35709c58b Martin KaFai Lau 2021-07-01 2339 spin_lock(&ilb2->lock);
05c0b35709c58b Martin KaFai Lau 2021-07-01 2340 inet_lhash2_for_each_icsk(icsk, &ilb2->head) {
05c0b35709c58b Martin KaFai Lau 2021-07-01 2341 sk = (struct sock *)icsk;
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 @2342 if (seq_sk_match(seq, sk))
604258c8f5a979 Ryan Cai 2022-01-21 2343 spin_unlock(&ilb2->lock);
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2344 return sk;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2345 }
05c0b35709c58b Martin KaFai Lau 2021-07-01 2346 spin_unlock(&ilb2->lock);
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2347 }
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2348
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2349 return NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2350 }
b72acf4501d7c3 Martin KaFai Lau 2021-07-01 2351
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
[RFC PATCH] virtio-crypto: virtio_crypto_rsa_do_req() can be static
by kernel test robot
drivers/crypto/virtio/virtio_crypto_akcipher_algo.c:276:5: warning: symbol 'virtio_crypto_rsa_do_req' was not declared. Should it be static?
Reported-by: kernel test robot <lkp(a)intel.com>
Signed-off-by: kernel test robot <lkp(a)intel.com>
---
virtio_crypto_akcipher_algo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/virtio/virtio_crypto_akcipher_algo.c b/drivers/crypto/virtio/virtio_crypto_akcipher_algo.c
index eebccf71b2fab..2b3f8780b7551 100644
--- a/drivers/crypto/virtio/virtio_crypto_akcipher_algo.c
+++ b/drivers/crypto/virtio/virtio_crypto_akcipher_algo.c
@@ -273,7 +273,7 @@ static int __virtio_crypto_akcipher_do_req(struct virtio_crypto_akcipher_request
return -ENOMEM;
}
-int virtio_crypto_rsa_do_req(struct crypto_engine *engine, void *vreq)
+static int virtio_crypto_rsa_do_req(struct crypto_engine *engine, void *vreq)
{
struct akcipher_request *req = container_of(vreq, struct akcipher_request, base);
struct virtio_crypto_akcipher_request *vc_akcipher_req = akcipher_request_ctx(req);
8 months
[intel-lts:5.4/yocto 11123/20394] include/linux/bitfield.h:106:17: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
by kernel test robot
Hi Poey,
FYI, the error/warning still remains.
tree: https://github.com/intel/linux-intel-lts.git 5.4/yocto
head: 36f93ff941f127f4137ab369aecbdd995fb58c66
commit: c5612e33a5de5b6ae673f25b4b36da9bf54e9ee5 [11123/20394] pwm: Add count attribute in sysfs for Intel Keem Bay
config: nds32-buildonly-randconfig-r005-20220119 (https://download.01.org/0day-ci/archive/20220121/202201211634.Gsb8Nf6P-lk...)
compiler: nds32le-linux-gcc (GCC) 11.2.0
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
# https://github.com/intel/linux-intel-lts/commit/c5612e33a5de5b6ae673f25b4...
git remote add intel-lts https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-lts 5.4/yocto
git checkout c5612e33a5de5b6ae673f25b4b36da9bf54e9ee5
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nds32 SHELL=/bin/bash drivers/pwm/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from drivers/pwm/pwm-keembay.c:16:
In function 'field_multiplier',
inlined from 'field_mask' at include/linux/bitfield.h:111:17,
inlined from 'u32_encode_bits' at include/linux/bitfield.h:140:1,
inlined from 'u32_replace_bits' at include/linux/bitfield.h:140:1,
inlined from 'keembay_pwm_update_bits' at drivers/pwm/pwm-keembay.c:55:9:
>> include/linux/bitfield.h:106:17: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
106 | __bad_mask();
| ^~~~~~~~~~~~
In function 'field_multiplier',
inlined from 'u32_encode_bits' at include/linux/bitfield.h:140:1,
inlined from 'u32_replace_bits' at include/linux/bitfield.h:140:1,
inlined from 'keembay_pwm_update_bits' at drivers/pwm/pwm-keembay.c:55:9:
>> include/linux/bitfield.h:106:17: error: call to '__bad_mask' declared with attribute error: bad bitfield mask
106 | __bad_mask();
| ^~~~~~~~~~~~
vim +/__bad_mask +106 include/linux/bitfield.h
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 43
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 44 #define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 45 ({ \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 46 BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 47 _pfx "mask is not constant"); \
e36488c83b6d87 Arnd Bergmann 2018-08-17 48 BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero"); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 49 BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 50 ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 51 _pfx "value too large for the field"); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 52 BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 53 _pfx "type of reg too small for mask"); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 54 __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 55 (1ULL << __bf_shf(_mask))); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 56 })
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 57
1697599ee301a5 Jakub Kicinski 2017-02-09 58 /**
1697599ee301a5 Jakub Kicinski 2017-02-09 59 * FIELD_FIT() - check if value fits in the field
1697599ee301a5 Jakub Kicinski 2017-02-09 60 * @_mask: shifted mask defining the field's length and position
1697599ee301a5 Jakub Kicinski 2017-02-09 61 * @_val: value to test against the field
1697599ee301a5 Jakub Kicinski 2017-02-09 62 *
1697599ee301a5 Jakub Kicinski 2017-02-09 63 * Return: true if @_val can fit inside @_mask, false if @_val is too big.
1697599ee301a5 Jakub Kicinski 2017-02-09 64 */
1697599ee301a5 Jakub Kicinski 2017-02-09 65 #define FIELD_FIT(_mask, _val) \
1697599ee301a5 Jakub Kicinski 2017-02-09 66 ({ \
5be9072b8121b5 Jakub Kicinski 2020-08-10 67 __BF_FIELD_CHECK(_mask, 0ULL, 0ULL, "FIELD_FIT: "); \
1697599ee301a5 Jakub Kicinski 2017-02-09 68 !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \
1697599ee301a5 Jakub Kicinski 2017-02-09 69 })
1697599ee301a5 Jakub Kicinski 2017-02-09 70
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 71 /**
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 72 * FIELD_PREP() - prepare a bitfield element
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 73 * @_mask: shifted mask defining the field's length and position
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 74 * @_val: value to put in the field
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 75 *
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 76 * FIELD_PREP() masks and shifts up the value. The result should
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 77 * be combined with other fields of the bitfield using logical OR.
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 78 */
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 79 #define FIELD_PREP(_mask, _val) \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 80 ({ \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 81 __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 82 ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 83 })
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 84
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 85 /**
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 86 * FIELD_GET() - extract a bitfield element
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 87 * @_mask: shifted mask defining the field's length and position
7240767450d6d8 Masahiro Yamada 2017-10-03 88 * @_reg: value of entire bitfield
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 89 *
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 90 * FIELD_GET() extracts the field specified by @_mask from the
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 91 * bitfield passed in as @_reg by masking and shifting it down.
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 92 */
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 93 #define FIELD_GET(_mask, _reg) \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 94 ({ \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 95 __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 96 (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 97 })
3e9b3112ec74f1 Jakub Kicinski 2016-08-31 98
e7d4a95da86e0b Johannes Berg 2018-06-20 99 extern void __compiletime_error("value doesn't fit into mask")
00b0c9b82663ac Al Viro 2017-12-14 100 __field_overflow(void);
00b0c9b82663ac Al Viro 2017-12-14 101 extern void __compiletime_error("bad bitfield mask")
00b0c9b82663ac Al Viro 2017-12-14 102 __bad_mask(void);
00b0c9b82663ac Al Viro 2017-12-14 103 static __always_inline u64 field_multiplier(u64 field)
00b0c9b82663ac Al Viro 2017-12-14 104 {
00b0c9b82663ac Al Viro 2017-12-14 105 if ((field | (field - 1)) & ((field | (field - 1)) + 1))
00b0c9b82663ac Al Viro 2017-12-14 @106 __bad_mask();
00b0c9b82663ac Al Viro 2017-12-14 107 return field & -field;
00b0c9b82663ac Al Viro 2017-12-14 108 }
00b0c9b82663ac Al Viro 2017-12-14 109 static __always_inline u64 field_mask(u64 field)
00b0c9b82663ac Al Viro 2017-12-14 110 {
00b0c9b82663ac Al Viro 2017-12-14 @111 return field / field_multiplier(field);
00b0c9b82663ac Al Viro 2017-12-14 112 }
00b0c9b82663ac Al Viro 2017-12-14 113 #define ____MAKE_OP(type,base,to,from) \
00b0c9b82663ac Al Viro 2017-12-14 114 static __always_inline __##type type##_encode_bits(base v, base field) \
00b0c9b82663ac Al Viro 2017-12-14 115 { \
e7d4a95da86e0b Johannes Berg 2018-06-20 116 if (__builtin_constant_p(v) && (v & ~field_mask(field))) \
00b0c9b82663ac Al Viro 2017-12-14 117 __field_overflow(); \
00b0c9b82663ac Al Viro 2017-12-14 118 return to((v & field_mask(field)) * field_multiplier(field)); \
00b0c9b82663ac Al Viro 2017-12-14 119 } \
00b0c9b82663ac Al Viro 2017-12-14 120 static __always_inline __##type type##_replace_bits(__##type old, \
00b0c9b82663ac Al Viro 2017-12-14 121 base val, base field) \
00b0c9b82663ac Al Viro 2017-12-14 122 { \
00b0c9b82663ac Al Viro 2017-12-14 123 return (old & ~to(field)) | type##_encode_bits(val, field); \
00b0c9b82663ac Al Viro 2017-12-14 124 } \
00b0c9b82663ac Al Viro 2017-12-14 125 static __always_inline void type##p_replace_bits(__##type *p, \
00b0c9b82663ac Al Viro 2017-12-14 126 base val, base field) \
00b0c9b82663ac Al Viro 2017-12-14 127 { \
00b0c9b82663ac Al Viro 2017-12-14 128 *p = (*p & ~to(field)) | type##_encode_bits(val, field); \
00b0c9b82663ac Al Viro 2017-12-14 129 } \
00b0c9b82663ac Al Viro 2017-12-14 130 static __always_inline base type##_get_bits(__##type v, base field) \
00b0c9b82663ac Al Viro 2017-12-14 131 { \
00b0c9b82663ac Al Viro 2017-12-14 132 return (from(v) & field)/field_multiplier(field); \
00b0c9b82663ac Al Viro 2017-12-14 133 }
00b0c9b82663ac Al Viro 2017-12-14 134 #define __MAKE_OP(size) \
00b0c9b82663ac Al Viro 2017-12-14 135 ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \
00b0c9b82663ac Al Viro 2017-12-14 136 ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \
00b0c9b82663ac Al Viro 2017-12-14 137 ____MAKE_OP(u##size,u##size,,)
37a3862e123826 Johannes Berg 2018-06-20 138 ____MAKE_OP(u8,u8,,)
00b0c9b82663ac Al Viro 2017-12-14 139 __MAKE_OP(16)
00b0c9b82663ac Al Viro 2017-12-14 140 __MAKE_OP(32)
00b0c9b82663ac Al Viro 2017-12-14 141 __MAKE_OP(64)
00b0c9b82663ac Al Viro 2017-12-14 142 #undef __MAKE_OP
00b0c9b82663ac Al Viro 2017-12-14 143 #undef ____MAKE_OP
00b0c9b82663ac Al Viro 2017-12-14 144
:::::: The code at line 106 was first introduced by commit
:::::: 00b0c9b82663ac42e5a09f58ce960f81f29d64ee Add primitives for manipulating bitfields both in host- and fixed-endian.
:::::: TO: Al Viro <viro(a)zeniv.linux.org.uk>
:::::: CC: Al Viro <viro(a)zeniv.linux.org.uk>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months
Re: [PATCH] net: missing lock releases in ipmr_base.c
by kernel test robot
Hi ycaibb,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on net/master horms-ipvs/master linus/master v5.16 next-20220121]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/ycaibb/net-missing-lock-releases...
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 8aaaf2f3af2ae212428f4db1af34214225f5cec3
config: mips-bmips_stb_defconfig (https://download.01.org/0day-ci/archive/20220121/202201211524.XaQUNPO4-lk...)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d4baf3b1322b84816aa623d8e8cb45a49cb68b84)
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 mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/33b03feacaf2155323b031274d2d67dab...
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review ycaibb/net-missing-lock-releases-in-ipmr_base-c/20220121-112603
git checkout 33b03feacaf2155323b031274d2d67dab0cf561c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash net/ipv4/
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 >>):
>> net/ipv4/ipmr_base.c:158:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
return mfc;
^
net/ipv4/ipmr_base.c:156:3: note: previous statement is here
if (pos-- == 0)
^
net/ipv4/ipmr_base.c:166:4: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
return mfc;
^
net/ipv4/ipmr_base.c:164:3: note: previous statement is here
if (pos-- == 0)
^
2 warnings generated.
vim +/if +158 net/ipv4/ipmr_base.c
3feda6b46f7347 Yuval Mintz 2018-02-28 146
c8d61968032654 Yuval Mintz 2018-02-28 147 void *mr_mfc_seq_idx(struct net *net,
c8d61968032654 Yuval Mintz 2018-02-28 148 struct mr_mfc_iter *it, loff_t pos)
c8d61968032654 Yuval Mintz 2018-02-28 149 {
c8d61968032654 Yuval Mintz 2018-02-28 150 struct mr_table *mrt = it->mrt;
c8d61968032654 Yuval Mintz 2018-02-28 151 struct mr_mfc *mfc;
c8d61968032654 Yuval Mintz 2018-02-28 152
c8d61968032654 Yuval Mintz 2018-02-28 153 rcu_read_lock();
c8d61968032654 Yuval Mintz 2018-02-28 154 it->cache = &mrt->mfc_cache_list;
c8d61968032654 Yuval Mintz 2018-02-28 155 list_for_each_entry_rcu(mfc, &mrt->mfc_cache_list, list)
c8d61968032654 Yuval Mintz 2018-02-28 156 if (pos-- == 0)
33b03feacaf215 Ryan Cai 2022-01-21 157 rcu_read_unlock();
c8d61968032654 Yuval Mintz 2018-02-28 @158 return mfc;
c8d61968032654 Yuval Mintz 2018-02-28 159 rcu_read_unlock();
c8d61968032654 Yuval Mintz 2018-02-28 160
c8d61968032654 Yuval Mintz 2018-02-28 161 spin_lock_bh(it->lock);
c8d61968032654 Yuval Mintz 2018-02-28 162 it->cache = &mrt->mfc_unres_queue;
c8d61968032654 Yuval Mintz 2018-02-28 163 list_for_each_entry(mfc, it->cache, list)
c8d61968032654 Yuval Mintz 2018-02-28 164 if (pos-- == 0)
33b03feacaf215 Ryan Cai 2022-01-21 165 spin_unlock_bh(it->lock);
c8d61968032654 Yuval Mintz 2018-02-28 166 return mfc;
c8d61968032654 Yuval Mintz 2018-02-28 167 spin_unlock_bh(it->lock);
c8d61968032654 Yuval Mintz 2018-02-28 168
c8d61968032654 Yuval Mintz 2018-02-28 169 it->cache = NULL;
c8d61968032654 Yuval Mintz 2018-02-28 170 return NULL;
c8d61968032654 Yuval Mintz 2018-02-28 171 }
c8d61968032654 Yuval Mintz 2018-02-28 172 EXPORT_SYMBOL(mr_mfc_seq_idx);
c8d61968032654 Yuval Mintz 2018-02-28 173
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
8 months