Subject: [kbuild] Re: [PATCH 5/5] connector: Create connector per namespace

From: Dan Carpenter <[email-masked]>
Date: Thu, 2 Jul 2020 17:32:42 +0300

Hi Matt,

url:    https://github.com/0day-ci/linux/commits/Matt-Bennett/RFC-connector-Add-network-namespace-awareness/20200702-083030
base:   https://git.kernel.org/pub/scm/linux/kernel/git/horms/ipvs.git master
config: arm-randconfig-m031-20200701 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email-masked]>
Reported-by: Dan Carpenter <[email-masked]>

smatch warnings:
drivers/connector/connector.c:71 cn_netlink_send_mult() warn: impossible condition '(len < 0) => (0-u16max < 0)'

# https://github.com/0day-ci/linux/commit/32f49fbf9dcfe5c3bc100728f5b8b5f9c95757cb
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 32f49fbf9dcfe5c3bc100728f5b8b5f9c95757cb
vim +71 drivers/connector/connector.c

e921441014422d Matt Bennett             2020-07-02   59  int cn_netlink_send_mult(struct net *net, struct cn_msg *msg, u16 len,
                                                                                                                       ^^^^^^^

e921441014422d Matt Bennett             2020-07-02   60  			 u32 portid, u32 __group, gfp_t gfp_mask)
7672d0b5441137 Evgeniy Polyakov         2005-09-11   61  {
7672d0b5441137 Evgeniy Polyakov         2005-09-11   62  	struct cn_callback_entry *__cbq;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   63  	unsigned int size;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   64  	struct sk_buff *skb;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   65  	struct nlmsghdr *nlh;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   66  	struct cn_msg *data;
32f49fbf9dcfe5 Matt Bennett             2020-07-02   67  	struct cn_dev *dev = &(net->cdev);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   68  	u32 group = 0;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   69  	int found = 0;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   70  
32f49fbf9dcfe5 Matt Bennett             2020-07-02  @71  	if (!msg || len < 0)
                                                                            ^^^^^^^
Unsigned can't be less than zero.

32f49fbf9dcfe5 Matt Bennett             2020-07-02   72  		return -EINVAL;
32f49fbf9dcfe5 Matt Bennett             2020-07-02   73  
ac8f73305eea8a David Fries              2014-01-15   74  	if (portid || __group) {
ac8f73305eea8a David Fries              2014-01-15   75  		group = __group;
ac8f73305eea8a David Fries              2014-01-15   76  	} else {
7672d0b5441137 Evgeniy Polyakov         2005-09-11   77  		spin_lock_bh(&dev->cbdev->queue_lock);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   78  		list_for_each_entry(__cbq, &dev->cbdev->queue_list,
7672d0b5441137 Evgeniy Polyakov         2005-09-11   79  				    callback_entry) {
acd042bb2de50d Evgeniy Polyakov         2005-09-26   80  			if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
7672d0b5441137 Evgeniy Polyakov         2005-09-11   81  				found = 1;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   82  				group = __cbq->group;
fd00eeccd92b7b Li Zefan                 2008-01-04   83  				break;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   84  			}
7672d0b5441137 Evgeniy Polyakov         2005-09-11   85  		}
7672d0b5441137 Evgeniy Polyakov         2005-09-11   86  		spin_unlock_bh(&dev->cbdev->queue_lock);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   87  
7672d0b5441137 Evgeniy Polyakov         2005-09-11   88  		if (!found)
7672d0b5441137 Evgeniy Polyakov         2005-09-11   89  			return -ENODEV;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   90  	}
7672d0b5441137 Evgeniy Polyakov         2005-09-11   91  
ac8f73305eea8a David Fries              2014-01-15   92  	if (!portid && !netlink_has_listeners(dev->nls, group))
b191ba0d599928 Evgeniy Polyakov         2006-03-20   93  		return -ESRCH;
b191ba0d599928 Evgeniy Polyakov         2006-03-20   94  
34470e0bfae223 David Fries              2014-04-08   95  	size = sizeof(*msg) + len;
7672d0b5441137 Evgeniy Polyakov         2005-09-11   96  
9631d79e815197 Hong zhi guo             2013-03-27   97  	skb = nlmsg_new(size, gfp_mask);
7672d0b5441137 Evgeniy Polyakov         2005-09-11   98  	if (!skb)
7672d0b5441137 Evgeniy Polyakov         2005-09-11   99  		return -ENOMEM;
7672d0b5441137 Evgeniy Polyakov         2005-09-11  100  
9631d79e815197 Hong zhi guo             2013-03-27  101  	nlh = nlmsg_put(skb, 0, msg->seq, NLMSG_DONE, size, 0);
85c931665d822f Javier Martinez Canillas 2012-06-26  102  	if (!nlh) {
85c931665d822f Javier Martinez Canillas 2012-06-26  103  		kfree_skb(skb);
85c931665d822f Javier Martinez Canillas 2012-06-26  104  		return -EMSGSIZE;
85c931665d822f Javier Martinez Canillas 2012-06-26  105  	}
7672d0b5441137 Evgeniy Polyakov         2005-09-11  106  
85c931665d822f Javier Martinez Canillas 2012-06-26  107  	data = nlmsg_data(nlh);
7672d0b5441137 Evgeniy Polyakov         2005-09-11  108  
ac73bf50b709de Mathias Krause           2013-09-30  109  	memcpy(data, msg, size);
7672d0b5441137 Evgeniy Polyakov         2005-09-11  110  
7672d0b5441137 Evgeniy Polyakov         2005-09-11  111  	NETLINK_CB(skb).dst_group = group;
7672d0b5441137 Evgeniy Polyakov         2005-09-11  112  
ac8f73305eea8a David Fries              2014-01-15  113  	if (group)
ac8f73305eea8a David Fries              2014-01-15  114  		return netlink_broadcast(dev->nls, skb, portid, group,
ac8f73305eea8a David Fries              2014-01-15  115  					 gfp_mask);
d0164adc89f6bb Mel Gorman               2015-11-06  116  	return netlink_unicast(dev->nls, skb, portid,
d0164adc89f6bb Mel Gorman               2015-11-06  117  			!gfpflags_allow_blocking(gfp_mask));
7672d0b5441137 Evgeniy Polyakov         2005-09-11  118  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]
_______________________________________________
kbuild mailing list -- [email-masked]
To unsubscribe send an email to [email-masked]