All of lore.kernel.org
 help / color / mirror / Atom feed
* [congwang:sch_bpf 2/4] net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170)
@ 2022-05-23 13:22 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-05-22  5:23 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Cong Wang <xiyou.wangcong@gmail.com>

tree:   https://github.com/congwang/linux.git sch_bpf
head:   6ffa225aaaaa22848f4629fc911a682553f17770
commit: 87784a11f90e7582ee664b531af17f7ca6ce2b62 [2/4] bpf: introduce skb map
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220522/202205221325.tXVMMrOx-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170)

vim +/key +175 net/core/skb_map.c

87784a11f90e75 Cong Wang 2020-11-08  162  
87784a11f90e75 Cong Wang 2020-11-08  163  /* Called from syscall */
87784a11f90e75 Cong Wang 2020-11-08  164  static int skb_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
87784a11f90e75 Cong Wang 2020-11-08  165  {
87784a11f90e75 Cong Wang 2020-11-08  166  	struct bpf_skb_map *rb = bpf_skb_map(map);
87784a11f90e75 Cong Wang 2020-11-08  167  	struct sk_buff *skb;
87784a11f90e75 Cong Wang 2020-11-08  168  	u64 rank;
87784a11f90e75 Cong Wang 2020-11-08  169  
87784a11f90e75 Cong Wang 2020-11-08 @170  	if (!key) {
87784a11f90e75 Cong Wang 2020-11-08  171  		skb = skb_rb_first(&rb->root);
87784a11f90e75 Cong Wang 2020-11-08  172  		if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  173  			return -ENOENT;
87784a11f90e75 Cong Wang 2020-11-08  174  	}
87784a11f90e75 Cong Wang 2020-11-08 @175  	rank = *(u64 *) key;
87784a11f90e75 Cong Wang 2020-11-08  176  	skb = skb_rb_find(&rb->root, rank);
87784a11f90e75 Cong Wang 2020-11-08  177  	if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  178  		return -ENOENT;
87784a11f90e75 Cong Wang 2020-11-08  179  	skb = skb_rb_next(skb);
87784a11f90e75 Cong Wang 2020-11-08  180  	if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  181  		return 0;
87784a11f90e75 Cong Wang 2020-11-08  182  	*(u64 *) next_key = skb_map_cb(skb)->rank;
87784a11f90e75 Cong Wang 2020-11-08  183  	return 0;
87784a11f90e75 Cong Wang 2020-11-08  184  }
87784a11f90e75 Cong Wang 2020-11-08  185  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [congwang:sch_bpf 2/4] net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170)
@ 2022-05-23 13:22 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-05-23 13:22 UTC (permalink / raw)
  To: kbuild, Cong Wang; +Cc: lkp, kbuild-all, linux-kernel

tree:   https://github.com/congwang/linux.git sch_bpf
head:   6ffa225aaaaa22848f4629fc911a682553f17770
commit: 87784a11f90e7582ee664b531af17f7ca6ce2b62 [2/4] bpf: introduce skb map
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220522/202205221325.tXVMMrOx-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170)

vim +/key +175 net/core/skb_map.c

87784a11f90e75 Cong Wang 2020-11-08  164  static int skb_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
87784a11f90e75 Cong Wang 2020-11-08  165  {
87784a11f90e75 Cong Wang 2020-11-08  166  	struct bpf_skb_map *rb = bpf_skb_map(map);
87784a11f90e75 Cong Wang 2020-11-08  167  	struct sk_buff *skb;
87784a11f90e75 Cong Wang 2020-11-08  168  	u64 rank;
87784a11f90e75 Cong Wang 2020-11-08  169  
87784a11f90e75 Cong Wang 2020-11-08 @170  	if (!key) {

If key is NULL

87784a11f90e75 Cong Wang 2020-11-08  171  		skb = skb_rb_first(&rb->root);
87784a11f90e75 Cong Wang 2020-11-08  172  		if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  173  			return -ENOENT;
87784a11f90e75 Cong Wang 2020-11-08  174  	}
87784a11f90e75 Cong Wang 2020-11-08 @175  	rank = *(u64 *) key;

Then we are toasted

87784a11f90e75 Cong Wang 2020-11-08  176  	skb = skb_rb_find(&rb->root, rank);
87784a11f90e75 Cong Wang 2020-11-08  177  	if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  178  		return -ENOENT;
87784a11f90e75 Cong Wang 2020-11-08  179  	skb = skb_rb_next(skb);
87784a11f90e75 Cong Wang 2020-11-08  180  	if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  181  		return 0;
87784a11f90e75 Cong Wang 2020-11-08  182  	*(u64 *) next_key = skb_map_cb(skb)->rank;
87784a11f90e75 Cong Wang 2020-11-08  183  	return 0;
87784a11f90e75 Cong Wang 2020-11-08  184  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [congwang:sch_bpf 2/4] net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170)
@ 2022-05-23 13:22 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-05-23 13:22 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2131 bytes --]

tree:   https://github.com/congwang/linux.git sch_bpf
head:   6ffa225aaaaa22848f4629fc911a682553f17770
commit: 87784a11f90e7582ee664b531af17f7ca6ce2b62 [2/4] bpf: introduce skb map
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220522/202205221325.tXVMMrOx-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-1) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170)

vim +/key +175 net/core/skb_map.c

87784a11f90e75 Cong Wang 2020-11-08  164  static int skb_map_get_next_key(struct bpf_map *map, void *key, void *next_key)
87784a11f90e75 Cong Wang 2020-11-08  165  {
87784a11f90e75 Cong Wang 2020-11-08  166  	struct bpf_skb_map *rb = bpf_skb_map(map);
87784a11f90e75 Cong Wang 2020-11-08  167  	struct sk_buff *skb;
87784a11f90e75 Cong Wang 2020-11-08  168  	u64 rank;
87784a11f90e75 Cong Wang 2020-11-08  169  
87784a11f90e75 Cong Wang 2020-11-08 @170  	if (!key) {

If key is NULL

87784a11f90e75 Cong Wang 2020-11-08  171  		skb = skb_rb_first(&rb->root);
87784a11f90e75 Cong Wang 2020-11-08  172  		if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  173  			return -ENOENT;
87784a11f90e75 Cong Wang 2020-11-08  174  	}
87784a11f90e75 Cong Wang 2020-11-08 @175  	rank = *(u64 *) key;

Then we are toasted

87784a11f90e75 Cong Wang 2020-11-08  176  	skb = skb_rb_find(&rb->root, rank);
87784a11f90e75 Cong Wang 2020-11-08  177  	if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  178  		return -ENOENT;
87784a11f90e75 Cong Wang 2020-11-08  179  	skb = skb_rb_next(skb);
87784a11f90e75 Cong Wang 2020-11-08  180  	if (!skb)
87784a11f90e75 Cong Wang 2020-11-08  181  		return 0;
87784a11f90e75 Cong Wang 2020-11-08  182  	*(u64 *) next_key = skb_map_cb(skb)->rank;
87784a11f90e75 Cong Wang 2020-11-08  183  	return 0;
87784a11f90e75 Cong Wang 2020-11-08  184  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-23 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22  5:23 [congwang:sch_bpf 2/4] net/core/skb_map.c:175 skb_map_get_next_key() error: we previously assumed 'key' could be null (see line 170) kernel test robot
2022-05-23 13:22 ` Dan Carpenter
2022-05-23 13:22 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.