All of lore.kernel.org
 help / color / mirror / Atom feed
* [jpirko-mlxsw:petrm_resilient 5/5] net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.
@ 2020-11-30 12:32 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-11-30 12:32 UTC (permalink / raw)
  To: kbuild

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

tree:   https://github.com/jpirko/linux_mlxsw petrm_resilient
head:   f89604f4fb4130335e42ccf65a969ad0a0f58166
commit: f89604f4fb4130335e42ccf65a969ad0a0f58166 [5/5] debugfs for nexthop [xxx]
config: i386-randconfig-m021-20201120 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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

smatch warnings:
net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.

vim +/err +2638 net/ipv4/nexthop.c

f89604f4fb41303 Petr Machata 2020-11-19  2589  static ssize_t nexthop_dfs_bucket_activity_write(struct file *file,
f89604f4fb41303 Petr Machata 2020-11-19  2590  						 const char __user *user_buf,
f89604f4fb41303 Petr Machata 2020-11-19  2591  						 size_t size, loff_t *ppos)
f89604f4fb41303 Petr Machata 2020-11-19  2592  {
f89604f4fb41303 Petr Machata 2020-11-19  2593  	const char *tok_bucketid;
f89604f4fb41303 Petr Machata 2020-11-19  2594  	const char *tok_nhid;
f89604f4fb41303 Petr Machata 2020-11-19  2595  	struct nexthop *nh;
f89604f4fb41303 Petr Machata 2020-11-19  2596  	loff_t pos = *ppos;
f89604f4fb41303 Petr Machata 2020-11-19  2597  	char buf[128];
f89604f4fb41303 Petr Machata 2020-11-19  2598  	u16 bucketid; // xxx or u32 if we choose so
f89604f4fb41303 Petr Machata 2020-11-19  2599  	char *ptr;
f89604f4fb41303 Petr Machata 2020-11-19  2600  	u32 nhid;
f89604f4fb41303 Petr Machata 2020-11-19  2601  	int err;
f89604f4fb41303 Petr Machata 2020-11-19  2602  
f89604f4fb41303 Petr Machata 2020-11-19  2603  	if (pos < 0)
f89604f4fb41303 Petr Machata 2020-11-19  2604  		return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19  2605  	if (pos == size)
f89604f4fb41303 Petr Machata 2020-11-19  2606  		goto skip;

"err" not set on this path.

f89604f4fb41303 Petr Machata 2020-11-19  2607  	if (pos)
f89604f4fb41303 Petr Machata 2020-11-19  2608  		return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19  2609  	if (size > sizeof(buf))
f89604f4fb41303 Petr Machata 2020-11-19  2610  		return -ENOMEM;
f89604f4fb41303 Petr Machata 2020-11-19  2611          if (copy_from_user(buf, user_buf, size))
f89604f4fb41303 Petr Machata 2020-11-19  2612                  return -EFAULT;
f89604f4fb41303 Petr Machata 2020-11-19  2613  
f89604f4fb41303 Petr Machata 2020-11-19  2614  	buf[sizeof(buf) - 1] = '\0';
f89604f4fb41303 Petr Machata 2020-11-19  2615  	ptr = buf;
f89604f4fb41303 Petr Machata 2020-11-19  2616  	tok_nhid = strsep(&ptr, " \t");
f89604f4fb41303 Petr Machata 2020-11-19  2617  	tok_bucketid = strsep(&ptr, " \t");
f89604f4fb41303 Petr Machata 2020-11-19  2618  
f89604f4fb41303 Petr Machata 2020-11-19  2619  	if (!tok_nhid || !tok_bucketid || ptr)
f89604f4fb41303 Petr Machata 2020-11-19  2620  		return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19  2621  
f89604f4fb41303 Petr Machata 2020-11-19  2622  	err = kstrtou32(tok_nhid, 0, &nhid);
f89604f4fb41303 Petr Machata 2020-11-19  2623  	if (err)
f89604f4fb41303 Petr Machata 2020-11-19  2624  		return err;
f89604f4fb41303 Petr Machata 2020-11-19  2625  
f89604f4fb41303 Petr Machata 2020-11-19  2626  	err = kstrtou16(tok_bucketid, 0, &bucketid);
f89604f4fb41303 Petr Machata 2020-11-19  2627  	if (err)
f89604f4fb41303 Petr Machata 2020-11-19  2628  		return err;
f89604f4fb41303 Petr Machata 2020-11-19  2629  
f89604f4fb41303 Petr Machata 2020-11-19  2630  	rcu_read_lock();
f89604f4fb41303 Petr Machata 2020-11-19  2631  	nh = nexthop_find_by_id(&init_net, nhid);
f89604f4fb41303 Petr Machata 2020-11-19  2632  	if (!nh || !nexthop_select_path(nh, bucketid))
f89604f4fb41303 Petr Machata 2020-11-19  2633  		err = -ENOENT;
f89604f4fb41303 Petr Machata 2020-11-19  2634  	rcu_read_unlock();
f89604f4fb41303 Petr Machata 2020-11-19  2635  
f89604f4fb41303 Petr Machata 2020-11-19  2636  skip:
f89604f4fb41303 Petr Machata 2020-11-19  2637  	*ppos = size;
f89604f4fb41303 Petr Machata 2020-11-19 @2638  	return err ?: size;
                                                       ^^^
Uninitialized.

f89604f4fb41303 Petr Machata 2020-11-19  2639  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31145 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [jpirko-mlxsw:petrm_resilient 5/5] net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.
@ 2020-11-20  7:39 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2020-11-20  7:39 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: Petr Machata <me@pmachata.org>

tree:   https://github.com/jpirko/linux_mlxsw petrm_resilient
head:   f89604f4fb4130335e42ccf65a969ad0a0f58166
commit: f89604f4fb4130335e42ccf65a969ad0a0f58166 [5/5] debugfs for nexthop [xxx]
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: i386-randconfig-m021-20201120 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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

smatch warnings:
net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.

vim +/err +2638 net/ipv4/nexthop.c

f89604f4fb41303 Petr Machata 2020-11-19  2588  
f89604f4fb41303 Petr Machata 2020-11-19  2589  static ssize_t nexthop_dfs_bucket_activity_write(struct file *file,
f89604f4fb41303 Petr Machata 2020-11-19  2590  						 const char __user *user_buf,
f89604f4fb41303 Petr Machata 2020-11-19  2591  						 size_t size, loff_t *ppos)
f89604f4fb41303 Petr Machata 2020-11-19  2592  {
f89604f4fb41303 Petr Machata 2020-11-19  2593  	const char *tok_bucketid;
f89604f4fb41303 Petr Machata 2020-11-19  2594  	const char *tok_nhid;
f89604f4fb41303 Petr Machata 2020-11-19  2595  	struct nexthop *nh;
f89604f4fb41303 Petr Machata 2020-11-19  2596  	loff_t pos = *ppos;
f89604f4fb41303 Petr Machata 2020-11-19  2597  	char buf[128];
f89604f4fb41303 Petr Machata 2020-11-19  2598  	u16 bucketid; // xxx or u32 if we choose so
f89604f4fb41303 Petr Machata 2020-11-19  2599  	char *ptr;
f89604f4fb41303 Petr Machata 2020-11-19  2600  	u32 nhid;
f89604f4fb41303 Petr Machata 2020-11-19  2601  	int err;
f89604f4fb41303 Petr Machata 2020-11-19  2602  
f89604f4fb41303 Petr Machata 2020-11-19  2603  	if (pos < 0)
f89604f4fb41303 Petr Machata 2020-11-19  2604  		return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19  2605  	if (pos == size)
f89604f4fb41303 Petr Machata 2020-11-19  2606  		goto skip;
f89604f4fb41303 Petr Machata 2020-11-19  2607  	if (pos)
f89604f4fb41303 Petr Machata 2020-11-19  2608  		return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19  2609  	if (size > sizeof(buf))
f89604f4fb41303 Petr Machata 2020-11-19  2610  		return -ENOMEM;
f89604f4fb41303 Petr Machata 2020-11-19  2611          if (copy_from_user(buf, user_buf, size))
f89604f4fb41303 Petr Machata 2020-11-19  2612                  return -EFAULT;
f89604f4fb41303 Petr Machata 2020-11-19  2613  
f89604f4fb41303 Petr Machata 2020-11-19  2614  	buf[sizeof(buf) - 1] = '\0';
f89604f4fb41303 Petr Machata 2020-11-19  2615  	ptr = buf;
f89604f4fb41303 Petr Machata 2020-11-19  2616  	tok_nhid = strsep(&ptr, " \t");
f89604f4fb41303 Petr Machata 2020-11-19  2617  	tok_bucketid = strsep(&ptr, " \t");
f89604f4fb41303 Petr Machata 2020-11-19  2618  
f89604f4fb41303 Petr Machata 2020-11-19  2619  	if (!tok_nhid || !tok_bucketid || ptr)
f89604f4fb41303 Petr Machata 2020-11-19  2620  		return -EINVAL;
f89604f4fb41303 Petr Machata 2020-11-19  2621  
f89604f4fb41303 Petr Machata 2020-11-19  2622  	err = kstrtou32(tok_nhid, 0, &nhid);
f89604f4fb41303 Petr Machata 2020-11-19  2623  	if (err)
f89604f4fb41303 Petr Machata 2020-11-19  2624  		return err;
f89604f4fb41303 Petr Machata 2020-11-19  2625  
f89604f4fb41303 Petr Machata 2020-11-19  2626  	err = kstrtou16(tok_bucketid, 0, &bucketid);
f89604f4fb41303 Petr Machata 2020-11-19  2627  	if (err)
f89604f4fb41303 Petr Machata 2020-11-19  2628  		return err;
f89604f4fb41303 Petr Machata 2020-11-19  2629  
f89604f4fb41303 Petr Machata 2020-11-19  2630  	rcu_read_lock();
f89604f4fb41303 Petr Machata 2020-11-19  2631  	nh = nexthop_find_by_id(&init_net, nhid);
f89604f4fb41303 Petr Machata 2020-11-19  2632  	if (!nh || !nexthop_select_path(nh, bucketid))
f89604f4fb41303 Petr Machata 2020-11-19  2633  		err = -ENOENT;
f89604f4fb41303 Petr Machata 2020-11-19  2634  	rcu_read_unlock();
f89604f4fb41303 Petr Machata 2020-11-19  2635  
f89604f4fb41303 Petr Machata 2020-11-19  2636  skip:
f89604f4fb41303 Petr Machata 2020-11-19  2637  	*ppos = size;
f89604f4fb41303 Petr Machata 2020-11-19 @2638  	return err ?: size;
f89604f4fb41303 Petr Machata 2020-11-19  2639  }
f89604f4fb41303 Petr Machata 2020-11-19  2640  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31145 bytes --]

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

end of thread, other threads:[~2020-11-30 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-30 12:32 [jpirko-mlxsw:petrm_resilient 5/5] net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err' Dan Carpenter
2020-11-30 12:32 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-11-20  7:39 kernel test robot

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.