* [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warning
@ 2020-04-22 22:31 Stephen Hemminger
2020-04-28 9:38 ` Slava Ovsiienko
2020-04-29 12:20 ` Raslan Darawsheh
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Hemminger @ 2020-04-22 22:31 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, matan
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.
Fixes: fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")
Cc: matan@mellanox.com
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
v2 - add DCO
drivers/common/mlx5/mlx5_nl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/common/mlx5/mlx5_nl.c b/drivers/common/mlx5/mlx5_nl.c
index 847e78dbcea6..c6014c3ee0b3 100644
--- a/drivers/common/mlx5/mlx5_nl.c
+++ b/drivers/common/mlx5/mlx5_nl.c
@@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warning
2020-04-22 22:31 [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warning Stephen Hemminger
@ 2020-04-28 9:38 ` Slava Ovsiienko
2020-04-29 12:20 ` Raslan Darawsheh
1 sibling, 0 replies; 3+ messages in thread
From: Slava Ovsiienko @ 2020-04-28 9:38 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Matan Azrad
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Thursday, April 23, 2020 1:32
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Matan Azrad
> <matan@mellanox.com>
> Subject: [dpdk-dev] [PATCH v2] 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.
>
> Fixes: fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")
> Cc: matan@mellanox.com
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
> v2 - add DCO
>
> drivers/common/mlx5/mlx5_nl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/common/mlx5/mlx5_nl.c
> b/drivers/common/mlx5/mlx5_nl.c index 847e78dbcea6..c6014c3ee0b3
> 100644
> --- a/drivers/common/mlx5/mlx5_nl.c
> +++ b/drivers/common/mlx5/mlx5_nl.c
> @@ -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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warning
2020-04-22 22:31 [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warning Stephen Hemminger
2020-04-28 9:38 ` Slava Ovsiienko
@ 2020-04-29 12:20 ` Raslan Darawsheh
1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2020-04-29 12:20 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Matan Azrad, stable
Hi,
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Stephen Hemminger
> Sent: Thursday, April 23, 2020 1:32 AM
> To: dev@dpdk.org
> Cc: Stephen Hemminger <stephen@networkplumber.org>; Matan Azrad
> <matan@mellanox.com>
> Subject: [dpdk-dev] [PATCH v2] 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.
>
> Fixes: fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")
> Cc: matan@mellanox.com
Added Cc: statble@dpdk.org
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> v2 - add DCO
>
> drivers/common/mlx5/mlx5_nl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/common/mlx5/mlx5_nl.c
> b/drivers/common/mlx5/mlx5_nl.c
> index 847e78dbcea6..c6014c3ee0b3 100644
> --- a/drivers/common/mlx5/mlx5_nl.c
> +++ b/drivers/common/mlx5/mlx5_nl.c
> @@ -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
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-29 12:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 22:31 [dpdk-dev] [PATCH v2] common/mlx5: fix uninitialized variable warning Stephen Hemminger
2020-04-28 9:38 ` Slava Ovsiienko
2020-04-29 12:20 ` Raslan Darawsheh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).