net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.
PATCH 5/5 net/ipv4/nexthop.c:2638 nexthop_dfs_bucket_activity_write() error: uninitialized symbol 'err'.
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 <[email protected]>
Reported-by Dan Carpenter <[email protected]>
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