tree:   https://github.com/dsahern/linux rtnl-dump-enhancements
head:   745e7e3c45bd516de34f29a76f6f631c1a9ea2de
commit: ec4d4abefb809aea66630f0a94177ce582011734 [23/27] net/ipv4: Plumb 
support for filtering route dumps

New smatch warnings:
net/ipv4/fib_frontend.c:902 inet_dump_fib() error: uninitialized symbol 'h'.

Old smatch warnings:
net/ipv4/fib_frontend.c:581 rtentry_to_fib_config() warn: double check that 
we're allocating correct size: 4 vs 8

# 
https://github.com/dsahern/linux/commit/ec4d4abefb809aea66630f0a94177ce582011734
git remote add dsahern-linux https://github.com/dsahern/linux
git remote update dsahern-linux
git checkout ec4d4abefb809aea66630f0a94177ce582011734
vim +/h +902 net/ipv4/fib_frontend.c

1b435d3da David Ahern       2018-10-01  837  
63f3444fb Thomas Graf       2007-03-22  838  static int inet_dump_fib(struct 
sk_buff *skb, struct netlink_callback *cb)
^1da177e4 Linus Torvalds    2005-04-16  839  {
1b435d3da David Ahern       2018-10-01  840     const struct nlmsghdr *nlh = 
cb->nlh;
3b1e0a655 YOSHIFUJI Hideaki 2008-03-26  841     struct net *net = 
sock_net(skb->sk);
d3190d3ad David Ahern       2018-10-01  842     struct fib_dump_filter filter = 
{};
1af5a8c4a Patrick McHardy   2006-08-10  843     unsigned int h, s_h;
1af5a8c4a Patrick McHardy   2006-08-10  844     unsigned int e = 0, s_e;
^1da177e4 Linus Torvalds    2005-04-16  845     struct fib_table *tb;
e4aef8aea Denis V. Lunev    2008-01-10  846     struct hlist_head *head;
f6c5775ff David Ahern       2017-05-15  847     int dumped = 0, err;
^1da177e4 Linus Torvalds    2005-04-16  848  
1b435d3da David Ahern       2018-10-01  849     if (cb->strict_check) {
d3190d3ad David Ahern       2018-10-01  850             err = 
ip_valid_fib_dump_req(nlh, &filter, cb->extack);
1b435d3da David Ahern       2018-10-01  851             if (err)
1b435d3da David Ahern       2018-10-01  852                     return err;
1b435d3da David Ahern       2018-10-01  853     }
1b435d3da David Ahern       2018-10-01  854  
1b435d3da David Ahern       2018-10-01  855     if (nlmsg_len(nlh) >= 
sizeof(struct rtmsg) &&
1b435d3da David Ahern       2018-10-01  856         ((struct rtmsg 
*)nlmsg_data(nlh))->rtm_flags & RTM_F_CLONED)
0b8c7f6f2 Li RongQing       2014-03-21  857             return skb->len;
^1da177e4 Linus Torvalds    2005-04-16  858  
1af5a8c4a Patrick McHardy   2006-08-10  859     s_h = cb->args[0];
1af5a8c4a Patrick McHardy   2006-08-10  860     s_e = cb->args[1];
1af5a8c4a Patrick McHardy   2006-08-10  861  
a7e535312 Alexander Duyck   2015-03-04  862     rcu_read_lock();
a7e535312 Alexander Duyck   2015-03-04  863  
ec4d4abef David Ahern       2018-10-01  864     if (filter.ifindex) {
ec4d4abef David Ahern       2018-10-01  865             filter.dev = 
dev_get_by_index_rcu(net, filter.ifindex);
ec4d4abef David Ahern       2018-10-01  866             if (!filter.dev) {
ec4d4abef David Ahern       2018-10-01  867                     err = -ENODEV;
ec4d4abef David Ahern       2018-10-01  868                     goto out_err;
ec4d4abef David Ahern       2018-10-01  869             }
ec4d4abef David Ahern       2018-10-01  870     }
ec4d4abef David Ahern       2018-10-01  871  
1af5a8c4a Patrick McHardy   2006-08-10  872     for (h = s_h; h < 
FIB_TABLE_HASHSZ; h++, s_e = 0) {
1af5a8c4a Patrick McHardy   2006-08-10  873             e = 0;
e4aef8aea Denis V. Lunev    2008-01-10  874             head = 
&net->ipv4.fib_table_hash[h];
a7e535312 Alexander Duyck   2015-03-04  875             
hlist_for_each_entry_rcu(tb, head, tb_hlist) {
1af5a8c4a Patrick McHardy   2006-08-10  876                     if (e < s_e)
1af5a8c4a Patrick McHardy   2006-08-10  877                             goto 
next;
ec4d4abef David Ahern       2018-10-01  878                     if 
(filter.table_id && filter.table_id != tb->tb_id)
ec4d4abef David Ahern       2018-10-01  879                             goto 
next;
ec4d4abef David Ahern       2018-10-01  880  
1af5a8c4a Patrick McHardy   2006-08-10  881                     if (dumped)
1af5a8c4a Patrick McHardy   2006-08-10  882                             
memset(&cb->args[2], 0, sizeof(cb->args) -
1af5a8c4a Patrick McHardy   2006-08-10  883                                     
         2 * sizeof(cb->args[0]));
ec4d4abef David Ahern       2018-10-01  884                     err = 
fib_table_dump(tb, skb, cb, &filter);
f6c5775ff David Ahern       2017-05-15  885                     if (err < 0) {
f6c5775ff David Ahern       2017-05-15  886                             if 
(likely(skb->len))
1af5a8c4a Patrick McHardy   2006-08-10  887                                     
goto out;
f6c5775ff David Ahern       2017-05-15  888  
f6c5775ff David Ahern       2017-05-15  889                             goto 
out_err;
f6c5775ff David Ahern       2017-05-15  890                     }
1af5a8c4a Patrick McHardy   2006-08-10  891                     dumped = 1;
1af5a8c4a Patrick McHardy   2006-08-10  892  next:
1af5a8c4a Patrick McHardy   2006-08-10  893                     e++;
^1da177e4 Linus Torvalds    2005-04-16  894             }
1af5a8c4a Patrick McHardy   2006-08-10  895     }
1af5a8c4a Patrick McHardy   2006-08-10  896  out:
f6c5775ff David Ahern       2017-05-15  897     err = skb->len;
f6c5775ff David Ahern       2017-05-15  898  out_err:
a7e535312 Alexander Duyck   2015-03-04  899     rcu_read_unlock();
a7e535312 Alexander Duyck   2015-03-04  900  
1af5a8c4a Patrick McHardy   2006-08-10  901     cb->args[1] = e;
1af5a8c4a Patrick McHardy   2006-08-10 @902     cb->args[0] = h;
^1da177e4 Linus Torvalds    2005-04-16  903  
f6c5775ff David Ahern       2017-05-15  904     return err;
^1da177e4 Linus Torvalds    2005-04-16  905  }
^1da177e4 Linus Torvalds    2005-04-16  906  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
_______________________________________________
kbuild mailing list
kbuild@lists.01.org
https://lists.01.org/mailman/listinfo/kbuild

Reply via email to