[bug report] vdpa/mlx5: Add RX counters to debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Eli Cohen,

The patch 7fc5e9ed0777: "vdpa/mlx5: Add RX counters to debugfs" from
Nov 14, 2022, leads to the following Smatch static checker warning:

	drivers/vdpa/mlx5/net/mlx5_vnet.c:1497 mlx5_vdpa_add_mac_vlan_rules()
	error: uninitialized symbol 'rule'.

drivers/vdpa/mlx5/net/mlx5_vnet.c
    1452 static int mlx5_vdpa_add_mac_vlan_rules(struct mlx5_vdpa_net *ndev, u8 *mac,
    1453                                         struct macvlan_node *node)
    1454 {
    1455         struct mlx5_flow_destination dests[NUM_DESTS] = {};
    1456         struct mlx5_flow_act flow_act = {};
    1457         struct mlx5_flow_handle *rule;
    1458         struct mlx5_flow_spec *spec;
    1459         void *headers_c;
    1460         void *headers_v;
    1461         u8 *dmac_c;
    1462         u8 *dmac_v;
    1463         int err;
    1464         u16 vid;
    1465 
    1466         spec = kvzalloc(sizeof(*spec), GFP_KERNEL);
    1467         if (!spec)
    1468                 return -ENOMEM;
    1469 
    1470         vid = key2vid(node->macvlan);
    1471         spec->match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
    1472         headers_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria, outer_headers);
    1473         headers_v = MLX5_ADDR_OF(fte_match_param, spec->match_value, outer_headers);
    1474         dmac_c = MLX5_ADDR_OF(fte_match_param, headers_c, outer_headers.dmac_47_16);
    1475         dmac_v = MLX5_ADDR_OF(fte_match_param, headers_v, outer_headers.dmac_47_16);
    1476         eth_broadcast_addr(dmac_c);
    1477         ether_addr_copy(dmac_v, mac);
    1478         if (ndev->mvdev.actual_features & BIT_ULL(VIRTIO_NET_F_CTRL_VLAN)) {
    1479                 MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1);
    1480                 MLX5_SET_TO_ONES(fte_match_set_lyr_2_4, headers_c, first_vid);
    1481         }
    1482         if (node->tagged) {
    1483                 MLX5_SET(fte_match_set_lyr_2_4, headers_v, cvlan_tag, 1);
    1484                 MLX5_SET(fte_match_set_lyr_2_4, headers_v, first_vid, vid);
    1485         }
    1486         flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
    1487         dests[0].type = MLX5_FLOW_DESTINATION_TYPE_TIR;
    1488         dests[0].tir_num = ndev->res.tirn;
    1489         err = add_steering_counters(ndev, node, &flow_act, dests);
    1490         if (err)
    1491                 goto out_free;
    1492 
    1493 #if defined(CONFIG_MLX5_VDPA_STEERING_DEBUG)
    1494         dests[1].counter_id = mlx5_fc_id(node->ucast_counter.counter);
    1495 #endif
    1496         node->ucast_rule = mlx5_add_flow_rules(ndev->rxft, spec, &flow_act, dests, NUM_DESTS);
--> 1497         if (IS_ERR(rule)) {

Checking the wrong variable.  It looks like maybe the fix for this
was already posted but only some of the thread made it to lore.kernel.org
so it's impossible to tell for sure.

    1498                 err = PTR_ERR(rule);
    1499                 goto err_ucast;
    1500         }
    1501 
    1502 #if defined(CONFIG_MLX5_VDPA_STEERING_DEBUG)
    1503         dests[1].counter_id = mlx5_fc_id(node->mcast_counter.counter);
    1504 #endif
    1505 
    1506         memset(dmac_c, 0, ETH_ALEN);
    1507         memset(dmac_v, 0, ETH_ALEN);
    1508         dmac_c[0] = 1;
    1509         dmac_v[0] = 1;
    1510         node->mcast_rule = mlx5_add_flow_rules(ndev->rxft, spec, &flow_act, dests, NUM_DESTS);
    1511         if (IS_ERR(rule)) {

Here too.

    1512                 err = PTR_ERR(rule);
    1513                 goto err_mcast;
    1514         }
    1515         kvfree(spec);
    1516         mlx5_vdpa_add_rx_counters(ndev, node);
    1517         return 0;
    1518 
    1519 err_mcast:
    1520         mlx5_del_flow_rules(node->ucast_rule);
    1521 err_ucast:
    1522         remove_steering_counters(ndev, node);
    1523 out_free:
    1524         kvfree(spec);
    1525         return err;
    1526 }

regards,
dan carpenter
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization



[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux