common/mlx5: fix uninitialized variable warning
PATCH v2 1/1 common/mlx5: fix uninitialized variable warning
Gcc 8.3.0 (Debian 10) complains about unitilized variable.
[474/2122] Compiling C object 'drivers/a715181@@tmp_rte_common_mlx5@sta/common_mlx5_mlx5_nl.c.o'. In file included from ../drivers/common/mlx5/mlx5_nl.h:12,
from ../drivers/common/mlx5/mlx5_nl.c:23:
../drivers/common/mlx5/mlx5_nl.c: In function ‘mlx5_nl_enable_roce_get’:../drivers/common/mlx5/mlx5_common.h:68:2: warning: ‘cur_en’ may be used uninitialized in this function [-Wmaybe-uninitialized]
rte_log(RTE_LOG_ ## level, \
^~~~~~~../drivers/common/mlx5/mlx5_nl.c:1560:6: note: ‘cur_en’ was declared here
int cur_en;
^~~~~~The compiler is correct, this variable would only be set if kernel netlink response message contains the DEVLINK parameter that flags if ROCE is enabled.
---
v2 - add DCO
drivers/common/mlx5/mlx5_nl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/mlx5/mlx5_nl.c +1 -1
@@ -1557,7 +1557,7 @@ mlx5_nl_enable_roce_get(int nlsk_fd, int family_id, const char *pci_addr,struct genlmsghdr *genl;uint32_t sn =MLX5_NL_SN_GENERATE ;int ret; -int cur_en; +int cur_en =0 ; uint8_t buf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct genlmsghdr)) + NLMSG_ALIGN(sizeof(struct nlattr)) * 4 +
Signature · 1 line
2.20.1
Quoted 25 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Thursday, April 23, 2020 1:32
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Matan Azrad <[email protected]>
Subject: [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warningGcc 8.3.0 (Debian 10) complains about unitilized variable.
[474/2122] Compiling C object '
drivers/a715181@@tmp_rte_common_mlx5@sta/common_mlx5_mlx5_nl. c.o'.
In file included from../drivers/common/mlx5/mlx5_nl.h:12,from ../drivers/common/mlx5/mlx5_nl.c:23:
../drivers/common/mlx5/mlx5_nl.c: In function ‘mlx5_nl_enable_roce_get’:../drivers/common/mlx5/mlx5_common.h:68:2: warning: ‘cur_en’ may be used uninitialized in this function [-Wmaybe-uninitialized]
rte_log(RTE_LOG_ ## level, \
^~~~~~~../drivers/common/mlx5/mlx5_nl.c:1560:6: note: ‘cur_en’ was declared hereint cur_en; ^~~~~~
Quoted 7 lines
The compiler is correct, this variable would only be set if kernel netlink response message contains the DEVLINK parameter that flags if ROCE is enabled.
Fixes fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")Signed-off-by Stephen Hemminger <[email protected]>
Quoted 23 lines
---
v2 - add DCOdrivers/common/mlx5/mlx5_nl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/common/mlx5/mlx5_nl.cindex847e78dbcea6..c6014c3ee0b3100644drivers/common/mlx5/mlx5_nl.c +1
-1@@ -1557,7 +1557,7 @@ mlx5_nl_enable_roce_get(int nlsk_fd, int family_id, const char *pci_addr, struct genlmsghdr *genl;uint32_t sn =MLX5_NL_SN_GENERATE ;int ret; -int cur_en; +int cur_en =0 ; uint8_t buf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct genlmsghdr)) +
NLMSG_ALIGN(sizeof(struct nlattr))* 4 +
--
2.20.1
Hi,
Quoted 25 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Thursday, April 23, 2020 1:32 AM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; Matan Azrad <[email protected]>
Subject: [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warningGcc 8.3.0 (Debian 10) complains about unitilized variable.
[474/2122] Compiling C object '
drivers/a715181@@tmp_rte_common_mlx5@sta/common_mlx5_mlx5_nl.c.o'.
In file included from../drivers/common/mlx5/mlx5_nl.h:12,from ../drivers/common/mlx5/mlx5_nl.c:23:
../drivers/common/mlx5/mlx5_nl.c: In function ‘mlx5_nl_enable_roce_get’:../drivers/common/mlx5/mlx5_common.h:68:2: warning: ‘cur_en’ may be used uninitialized in this function [-Wmaybe-uninitialized]
rte_log(RTE_LOG_ ## level, \
^~~~~~~../drivers/common/mlx5/mlx5_nl.c:1560:6: note: ‘cur_en’ was declared hereint cur_en; ^~~~~~
Quoted 6 lines
The compiler is correct, this variable would only be set if kernel netlink response message contains the DEVLINK parameter that flags if ROCE is enabled.
Fixes fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")
Added Cc: [email protected]
Quoted 21 lines
Signed-off-by Stephen Hemminger <[email protected]>---
v2 - add DCOdrivers/common/mlx5/mlx5_nl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/common/mlx5/mlx5_nl.c +1
-1@@ -1557,7 +1557,7 @@ mlx5_nl_enable_roce_get(int nlsk_fd, int family_id, const char *pci_addr, struct genlmsghdr *genl;uint32_t sn =MLX5_NL_SN_GENERATE ;int ret; -int cur_en; +int cur_en =0 ; uint8_t buf[NLMSG_ALIGN(sizeof(struct nlmsghdr)) + NLMSG_ALIGN(sizeof(struct genlmsghdr)) +
Quoted 3 lines
NLMSG_ALIGN(sizeof(struct nlattr))* 4 +
--
2.20.1
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh