* [linux-next:master 7561/10638] drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: warning: variable 'err' is used uninitialized whenever 'if' condition is false
@ 2021-08-27 6:13 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-27 6:13 UTC (permalink / raw)
To: Vlad Buslov
Cc: llvm, kbuild-all, Linux Memory Management List, Saeed Mahameed,
Roi Dayan, Mark Bloch
[-- Attachment #1: Type: text/plain, Size: 9239 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 88fac11862d38306dd0d2398015744877140390d
commit: ff9b7521468bc2909293c1cda66a245a49688f6f [7561/10638] net/mlx5: Bridge, support LAG
config: x86_64-randconfig-a005-20210827 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=ff9b7521468bc2909293c1cda66a245a49688f6f
git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git fetch --no-tags linux-next master
git checkout ff9b7521468bc2909293c1cda66a245a49688f6f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
else if (mlx5_esw_bridge_dev_same_hw(rep, esw))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:164:9: note: uninitialized use occurs here
return err;
^~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:7: note: remove the 'if' if its condition is always true
else if (mlx5_esw_bridge_dev_same_hw(rep, esw))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:140:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
>> drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:262:7: warning: variable 'err' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:276:9: note: uninitialized use occurs here
return err;
^~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:257:7: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (attr->u.brport_flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:276:9: note: uninitialized use occurs here
return err;
^~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:257:3: note: remove the 'if' if its condition is always true
if (attr->u.brport_flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:247:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
3 warnings generated.
vim +157 drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
127
128 static int mlx5_esw_bridge_port_changeupper(struct notifier_block *nb, void *ptr)
129 {
130 struct mlx5_esw_bridge_offloads *br_offloads = container_of(nb,
131 struct mlx5_esw_bridge_offloads,
132 netdev_nb);
133 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
134 struct netdev_notifier_changeupper_info *info = ptr;
135 struct net_device *upper = info->upper_dev, *rep;
136 struct mlx5_eswitch *esw = br_offloads->esw;
137 u16 vport_num, esw_owner_vhca_id;
138 struct netlink_ext_ack *extack;
139 int ifindex = upper->ifindex;
140 int err;
141
142 if (!netif_is_bridge_master(upper))
143 return 0;
144
145 rep = mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, esw, &vport_num, &esw_owner_vhca_id);
146 if (!rep)
147 return 0;
148
149 extack = netdev_notifier_info_to_extack(&info->info);
150
151 if (mlx5_esw_bridge_is_local(dev, rep, esw))
152 err = info->linking ?
153 mlx5_esw_bridge_vport_link(ifindex, vport_num, esw_owner_vhca_id,
154 br_offloads, extack) :
155 mlx5_esw_bridge_vport_unlink(ifindex, vport_num, esw_owner_vhca_id,
156 br_offloads, extack);
> 157 else if (mlx5_esw_bridge_dev_same_hw(rep, esw))
158 err = info->linking ?
159 mlx5_esw_bridge_vport_peer_link(ifindex, vport_num, esw_owner_vhca_id,
160 br_offloads, extack) :
161 mlx5_esw_bridge_vport_peer_unlink(ifindex, vport_num, esw_owner_vhca_id,
162 br_offloads, extack);
163
164 return err;
165 }
166
167 static int mlx5_esw_bridge_switchdev_port_event(struct notifier_block *nb,
168 unsigned long event, void *ptr)
169 {
170 int err = 0;
171
172 switch (event) {
173 case NETDEV_PRECHANGEUPPER:
174 break;
175
176 case NETDEV_CHANGEUPPER:
177 err = mlx5_esw_bridge_port_changeupper(nb, ptr);
178 break;
179 }
180
181 return notifier_from_errno(err);
182 }
183
184 static int
185 mlx5_esw_bridge_port_obj_add(struct net_device *dev,
186 struct switchdev_notifier_port_obj_info *port_obj_info,
187 struct mlx5_esw_bridge_offloads *br_offloads)
188 {
189 struct netlink_ext_ack *extack = switchdev_notifier_info_to_extack(&port_obj_info->info);
190 const struct switchdev_obj *obj = port_obj_info->obj;
191 const struct switchdev_obj_port_vlan *vlan;
192 u16 vport_num, esw_owner_vhca_id;
193 int err;
194
195 if (!mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num,
196 &esw_owner_vhca_id))
197 return 0;
198
199 port_obj_info->handled = true;
200
201 switch (obj->id) {
202 case SWITCHDEV_OBJ_ID_PORT_VLAN:
203 vlan = SWITCHDEV_OBJ_PORT_VLAN(obj);
204 err = mlx5_esw_bridge_port_vlan_add(vport_num, esw_owner_vhca_id, vlan->vid,
205 vlan->flags, br_offloads, extack);
206 break;
207 default:
208 return -EOPNOTSUPP;
209 }
210 return err;
211 }
212
213 static int
214 mlx5_esw_bridge_port_obj_del(struct net_device *dev,
215 struct switchdev_notifier_port_obj_info *port_obj_info,
216 struct mlx5_esw_bridge_offloads *br_offloads)
217 {
218 const struct switchdev_obj *obj = port_obj_info->obj;
219 const struct switchdev_obj_port_vlan *vlan;
220 u16 vport_num, esw_owner_vhca_id;
221
222 if (!mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num,
223 &esw_owner_vhca_id))
224 return 0;
225
226 port_obj_info->handled = true;
227
228 switch (obj->id) {
229 case SWITCHDEV_OBJ_ID_PORT_VLAN:
230 vlan = SWITCHDEV_OBJ_PORT_VLAN(obj);
231 mlx5_esw_bridge_port_vlan_del(vport_num, esw_owner_vhca_id, vlan->vid, br_offloads);
232 break;
233 default:
234 return -EOPNOTSUPP;
235 }
236 return 0;
237 }
238
239 static int
240 mlx5_esw_bridge_port_obj_attr_set(struct net_device *dev,
241 struct switchdev_notifier_port_attr_info *port_attr_info,
242 struct mlx5_esw_bridge_offloads *br_offloads)
243 {
244 struct netlink_ext_ack *extack = switchdev_notifier_info_to_extack(&port_attr_info->info);
245 const struct switchdev_attr *attr = port_attr_info->attr;
246 u16 vport_num, esw_owner_vhca_id;
247 int err;
248
249 if (!mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num,
250 &esw_owner_vhca_id))
251 return 0;
252
253 port_attr_info->handled = true;
254
255 switch (attr->id) {
256 case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
257 if (attr->u.brport_flags.mask & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD)) {
258 NL_SET_ERR_MSG_MOD(extack, "Flag is not supported");
259 err = -EINVAL;
260 }
261 break;
> 262 case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
263 break;
264 case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
265 err = mlx5_esw_bridge_ageing_time_set(vport_num, esw_owner_vhca_id,
266 attr->u.ageing_time, br_offloads);
267 break;
268 case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
269 err = mlx5_esw_bridge_vlan_filtering_set(vport_num, esw_owner_vhca_id,
270 attr->u.vlan_filtering, br_offloads);
271 break;
272 default:
273 err = -EOPNOTSUPP;
274 }
275
276 return err;
277 }
278
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38750 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-27 6:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 6:13 [linux-next:master 7561/10638] drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c:157:11: warning: variable 'err' is used uninitialized whenever 'if' condition is false kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox