linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/mlx5e: Fix uninitialized variable
@ 2018-07-31 14:21 Gustavo A. R. Silva
  2018-07-31 14:50 ` Tariq Toukan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-07-31 14:21 UTC (permalink / raw)
  To: Tariq Toukan, Saeed Mahameed, Leon Romanovsky, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel, Gustavo A. R. Silva

There is a potential execution path in which variable *err* is returned
without being properly initialized previously.

Fix this by initializing variable *err* to 0.

Addresses-Coverity-ID: 1472116 ("Uninitialized scalar variable")
Fixes: 0ec13877ce95 ("net/mlx5e: Gather all XDP pre-requisite checks in a single function")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index fde3502..de2827a 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4215,7 +4215,7 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
 	struct mlx5e_priv *priv = netdev_priv(netdev);
 	struct bpf_prog *old_prog;
 	bool reset, was_opened;
-	int err;
+	int err = 0;
 	int i;
 
 	mutex_lock(&priv->state_lock);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net/mlx5e: Fix uninitialized variable
  2018-07-31 14:21 [PATCH] net/mlx5e: Fix uninitialized variable Gustavo A. R. Silva
@ 2018-07-31 14:50 ` Tariq Toukan
  2018-07-31 21:47 ` Saeed Mahameed
  2018-08-01 16:38 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Tariq Toukan @ 2018-07-31 14:50 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Tariq Toukan, Saeed Mahameed,
	Leon Romanovsky, David S. Miller
  Cc: netdev, linux-rdma, linux-kernel



On 31/07/2018 5:21 PM, Gustavo A. R. Silva wrote:
> There is a potential execution path in which variable *err* is returned
> without being properly initialized previously.
> 
> Fix this by initializing variable *err* to 0.
> 
> Addresses-Coverity-ID: 1472116 ("Uninitialized scalar variable")
> Fixes: 0ec13877ce95 ("net/mlx5e: Gather all XDP pre-requisite checks in a single function")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index fde3502..de2827a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -4215,7 +4215,7 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
>   	struct mlx5e_priv *priv = netdev_priv(netdev);
>   	struct bpf_prog *old_prog;
>   	bool reset, was_opened;
> -	int err;
> +	int err = 0;
>   	int i;
>   
>   	mutex_lock(&priv->state_lock);
> 

Reviewed-by: Tariq Toukan <tariqt@mellanox.com>

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net/mlx5e: Fix uninitialized variable
  2018-07-31 14:21 [PATCH] net/mlx5e: Fix uninitialized variable Gustavo A. R. Silva
  2018-07-31 14:50 ` Tariq Toukan
@ 2018-07-31 21:47 ` Saeed Mahameed
  2018-08-01 16:38 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Saeed Mahameed @ 2018-07-31 21:47 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Tariq Toukan, Saeed Mahameed, Leon Romanovsky, David S. Miller,
	Linux Netdev List, RDMA mailing list, linux-kernel

On Tue, Jul 31, 2018 at 7:21 AM, Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
> There is a potential execution path in which variable *err* is returned
> without being properly initialized previously.
>
> Fix this by initializing variable *err* to 0.
>
> Addresses-Coverity-ID: 1472116 ("Uninitialized scalar variable")
> Fixes: 0ec13877ce95 ("net/mlx5e: Gather all XDP pre-requisite checks in a single function")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Acked-by: Saeed Mahameed <saeedm@mellanox.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net/mlx5e: Fix uninitialized variable
  2018-07-31 14:21 [PATCH] net/mlx5e: Fix uninitialized variable Gustavo A. R. Silva
  2018-07-31 14:50 ` Tariq Toukan
  2018-07-31 21:47 ` Saeed Mahameed
@ 2018-08-01 16:38 ` David Miller
  2018-08-01 17:19   ` Gustavo A. R. Silva
  2 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2018-08-01 16:38 UTC (permalink / raw)
  To: gustavo; +Cc: tariqt, saeedm, leon, netdev, linux-rdma, linux-kernel

From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Tue, 31 Jul 2018 09:21:57 -0500

> There is a potential execution path in which variable *err* is returned
> without being properly initialized previously.
> 
> Fix this by initializing variable *err* to 0.
> 
> Addresses-Coverity-ID: 1472116 ("Uninitialized scalar variable")
> Fixes: 0ec13877ce95 ("net/mlx5e: Gather all XDP pre-requisite checks in a single function")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Applied to net-next.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net/mlx5e: Fix uninitialized variable
  2018-08-01 16:38 ` David Miller
@ 2018-08-01 17:19   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-08-01 17:19 UTC (permalink / raw)
  To: David Miller; +Cc: tariqt, saeedm, leon, netdev, linux-rdma, linux-kernel



On 08/01/2018 11:38 AM, David Miller wrote:
> From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
> Date: Tue, 31 Jul 2018 09:21:57 -0500
> 
>> There is a potential execution path in which variable *err* is returned
>> without being properly initialized previously.
>>
>> Fix this by initializing variable *err* to 0.
>>
>> Addresses-Coverity-ID: 1472116 ("Uninitialized scalar variable")
>> Fixes: 0ec13877ce95 ("net/mlx5e: Gather all XDP pre-requisite checks in a single function")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> 
> Applied to net-next.
> 

David,

Sorry I failed to tag this patch for net-next. I got a bit confused, once based on the logs,
the usual committer for this driver is Saeed Mahameed; not you. So, I wasn't quite sure about
how to proceed.

Thanks
--
Gustavo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-01 18:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 14:21 [PATCH] net/mlx5e: Fix uninitialized variable Gustavo A. R. Silva
2018-07-31 14:50 ` Tariq Toukan
2018-07-31 21:47 ` Saeed Mahameed
2018-08-01 16:38 ` David Miller
2018-08-01 17:19   ` Gustavo A. R. Silva

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).