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

From: kernel test robot
Date: Thu Jul 02 2020 - 02:53:32 EST


Hi Matt,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ipvs/master]
[also build test WARNING on dm/for-next linux/master linus/master v5.8-rc3 next-20200701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]

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: s390-randconfig-r016-20200701 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/connector/connector.c:9:
drivers/connector/connector.c: In function 'cn_netlink_send_mult':
drivers/connector/connector.c:71:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]
71 | if (!msg || len < 0)
| ^
include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
>> drivers/connector/connector.c:71:2: note: in expansion of macro 'if'
71 | if (!msg || len < 0)
| ^~
drivers/connector/connector.c:71:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]
71 | if (!msg || len < 0)
| ^
include/linux/compiler.h:58:61: note: in definition of macro '__trace_if_var'
58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
| ^~~~
>> drivers/connector/connector.c:71:2: note: in expansion of macro 'if'
71 | if (!msg || len < 0)
| ^~
drivers/connector/connector.c:71:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]
71 | if (!msg || len < 0)
| ^
include/linux/compiler.h:69:3: note: in definition of macro '__trace_if_value'
69 | (cond) ? \
| ^~~~
include/linux/compiler.h:56:28: note: in expansion of macro '__trace_if_var'
56 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
| ^~~~~~~~~~~~~~
>> drivers/connector/connector.c:71:2: note: in expansion of macro 'if'
71 | if (!msg || len < 0)
| ^~
drivers/connector/connector.c: At top level:
drivers/connector/connector.c:238:5: warning: no previous prototype for 'cn_add_callback_one' [-Wmissing-prototypes]
238 | int cn_add_callback_one(struct net *net, struct cb_id *id, const char *name,
| ^~~~~~~~~~~~~~~~~~~

vim +/if +71 drivers/connector/connector.c

30
31 /*
32 * Sends mult (multiple) cn_msg at a time.
33 *
34 * msg->seq and msg->ack are used to determine message genealogy.
35 * When someone sends message it puts there locally unique sequence
36 * and random acknowledge numbers. Sequence number may be copied into
37 * nlmsghdr->nlmsg_seq too.
38 *
39 * Sequence number is incremented with each message to be sent.
40 *
41 * If we expect a reply to our message then the sequence number in
42 * received message MUST be the same as in original message, and
43 * acknowledge number MUST be the same + 1.
44 *
45 * If we receive a message and its sequence number is not equal to the
46 * one we are expecting then it is a new message.
47 *
48 * If we receive a message and its sequence number is the same as one
49 * we are expecting but it's acknowledgement number is not equal to
50 * the acknowledgement number in the original message + 1, then it is
51 * a new message.
52 *
53 * If msg->len != len, then additional cn_msg messages are expected following
54 * the first msg.
55 *
56 * The message is sent to, the portid if given, the group if given, both if
57 * both, or if both are zero then the group is looked up and sent there.
58 */
59 int cn_netlink_send_mult(struct net *net, struct cn_msg *msg, u16 len,
60 u32 portid, u32 __group, gfp_t gfp_mask)
61 {
62 struct cn_callback_entry *__cbq;
63 unsigned int size;
64 struct sk_buff *skb;
65 struct nlmsghdr *nlh;
66 struct cn_msg *data;
67 struct cn_dev *dev = &(net->cdev);
68 u32 group = 0;
69 int found = 0;
70
> 71 if (!msg || len < 0)
72 return -EINVAL;
73
74 if (portid || __group) {
75 group = __group;
76 } else {
77 spin_lock_bh(&dev->cbdev->queue_lock);
78 list_for_each_entry(__cbq, &dev->cbdev->queue_list,
79 callback_entry) {
80 if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
81 found = 1;
82 group = __cbq->group;
83 break;
84 }
85 }
86 spin_unlock_bh(&dev->cbdev->queue_lock);
87
88 if (!found)
89 return -ENODEV;
90 }
91
92 if (!portid && !netlink_has_listeners(dev->nls, group))
93 return -ESRCH;
94
95 size = sizeof(*msg) + len;
96
97 skb = nlmsg_new(size, gfp_mask);
98 if (!skb)
99 return -ENOMEM;
100
101 nlh = nlmsg_put(skb, 0, msg->seq, NLMSG_DONE, size, 0);
102 if (!nlh) {
103 kfree_skb(skb);
104 return -EMSGSIZE;
105 }
106
107 data = nlmsg_data(nlh);
108
109 memcpy(data, msg, size);
110
111 NETLINK_CB(skb).dst_group = group;
112
113 if (group)
114 return netlink_broadcast(dev->nls, skb, portid, group,
115 gfp_mask);
116 return netlink_unicast(dev->nls, skb, portid,
117 !gfpflags_allow_blocking(gfp_mask));
118 }
119 EXPORT_SYMBOL_GPL(cn_netlink_send_mult);
120

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

Attachment: .config.gz
Description: application/gzip