netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netvsc: fix unititialized return value in variable ret
@ 2017-03-25 14:16 Colin King
  2017-03-27  0:52 ` Haiyang Zhang
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-03-25 14:16 UTC (permalink / raw)
  To: K . Y . Srinivasan, Haiyang Zhang, Stephen Hemminger, devel,
	netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

It is possible for an uninitialized value of ret to be returned
so fix this by initializing ret to zero.

Detected by CoverityScan, CID#1420762 ("Uninitialized scalar variable")

Fixes: 163891d7d429 ("netvsc: handle offline mtu and channel change")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/hyperv/netvsc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index eb7ae79d47bb..f830bbbd8ad4 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -855,7 +855,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu)
 	struct hv_device *hdev = ndevctx->device_ctx;
 	struct netvsc_device_info device_info;
 	bool was_running;
-	int ret;
+	int ret = 0;
 
 	if (!nvdev || nvdev->destroy)
 		return -ENODEV;
-- 
2.11.0

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

* RE: [PATCH] netvsc: fix unititialized return value in variable ret
  2017-03-25 14:16 [PATCH] netvsc: fix unititialized return value in variable ret Colin King
@ 2017-03-27  0:52 ` Haiyang Zhang
  0 siblings, 0 replies; 2+ messages in thread
From: Haiyang Zhang @ 2017-03-27  0:52 UTC (permalink / raw)
  To: Colin King, KY Srinivasan, Stephen Hemminger,
	devel@linuxdriverproject.org, netdev@vger.kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Colin King [mailto:colin.king@canonical.com]
> Sent: Saturday, March 25, 2017 10:17 AM
> To: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger <sthemmin@microsoft.com>;
> devel@linuxdriverproject.org; netdev@vger.kernel.org
> Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH] netvsc: fix unititialized return value in variable ret
> 
> From: Colin Ian King <colin.king@canonical.com>
> 
> It is possible for an uninitialized value of ret to be returned
> so fix this by initializing ret to zero.
> 
> Detected by CoverityScan, CID#1420762 ("Uninitialized scalar variable")
> 
> Fixes: 163891d7d429 ("netvsc: handle offline mtu and channel change")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/net/hyperv/netvsc_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c
> b/drivers/net/hyperv/netvsc_drv.c
> index eb7ae79d47bb..f830bbbd8ad4 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -855,7 +855,7 @@ static int netvsc_change_mtu(struct net_device *ndev,
> int mtu)
>  	struct hv_device *hdev = ndevctx->device_ctx;
>  	struct netvsc_device_info device_info;
>  	bool was_running;
> -	int ret;
> +	int ret = 0;

This was just fix by commit: 386f57622cc3bbb39b9c00fc8762bc9ab28e0f8d

Thanks.

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

end of thread, other threads:[~2017-03-27  0:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-25 14:16 [PATCH] netvsc: fix unititialized return value in variable ret Colin King
2017-03-27  0:52 ` Haiyang Zhang

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