linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Xen PATCH] xen-netback: fix error handling output
@ 2016-11-08 13:34 Arnd Bergmann
  2016-11-08 13:40 ` Paul Durrant
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Arnd Bergmann @ 2016-11-08 13:34 UTC (permalink / raw)
  To: David Vrabel
  Cc: Arnd Bergmann, Wei Liu, Paul Durrant, David S. Miller,
	Juergen Gross, Filipe Manco, xen-devel, netdev, linux-kernel

The connect function prints an unintialized error code after an
earlier initialization was removed:

drivers/net/xen-netback/xenbus.c: In function 'connect':
drivers/net/xen-netback/xenbus.c:938:3: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This prints it as -EINVAL instead, which seems to be the most
appropriate error code. Before the patch that caused the warning,
this would print a positive number returned by vsscanf() instead,
which is also wrong. We probably don't need a backport though,
as fixing the warning here should be sufficient.

Fixes: f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
Fixes: 8d3d53b3e433 ("xen-netback: Add support for multiple queues")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 7356e00fac54..bfed79877b8a 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -935,7 +935,7 @@ static void connect(struct backend_info *be)
 					"multi-queue-num-queues", 1);
 	if (requested_num_queues > xenvif_max_queues) {
 		/* buggy or malicious guest */
-		xenbus_dev_fatal(dev, err,
+		xenbus_dev_fatal(dev, -EINVAL,
 				 "guest requested %u queues, exceeding the maximum of %u.",
 				 requested_num_queues, xenvif_max_queues);
 		return;
-- 
2.9.0

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

* RE: [Xen PATCH] xen-netback: fix error handling output
  2016-11-08 13:34 [Xen PATCH] xen-netback: fix error handling output Arnd Bergmann
@ 2016-11-08 13:40 ` Paul Durrant
  2016-11-10  1:29 ` David Miller
  2016-11-10  9:14 ` Juergen Gross
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Durrant @ 2016-11-08 13:40 UTC (permalink / raw)
  To: Arnd Bergmann, David Vrabel
  Cc: Wei Liu, David S. Miller, Juergen Gross, Filipe Manco, xen-devel,
	netdev, linux-kernel

> -----Original Message-----
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> Sent: 08 November 2016 13:35
> To: David Vrabel <david.vrabel@citrix.com>
> Cc: Arnd Bergmann <arnd@arndb.de>; Wei Liu <wei.liu2@citrix.com>; Paul
> Durrant <Paul.Durrant@citrix.com>; David S. Miller
> <davem@davemloft.net>; Juergen Gross <jgross@suse.com>; Filipe Manco
> <filipe.manco@neclab.eu>; xen-devel@lists.xenproject.org;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [Xen PATCH] xen-netback: fix error handling output
> 
> The connect function prints an unintialized error code after an
> earlier initialization was removed:
> 
> drivers/net/xen-netback/xenbus.c: In function 'connect':
> drivers/net/xen-netback/xenbus.c:938:3: error: 'err' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This prints it as -EINVAL instead, which seems to be the most
> appropriate error code. Before the patch that caused the warning,
> this would print a positive number returned by vsscanf() instead,
> which is also wrong. We probably don't need a backport though,
> as fixing the warning here should be sufficient.
> 
> Fixes: f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-
> netback")
> Fixes: 8d3d53b3e433 ("xen-netback: Add support for multiple queues")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Yes, I'd say EINVAL was most appropriate.

Reviewed-by: Paul Durrant <paul.durrant@citrix.com>

> ---
>  drivers/net/xen-netback/xenbus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-
> netback/xenbus.c
> index 7356e00fac54..bfed79877b8a 100644
> --- a/drivers/net/xen-netback/xenbus.c
> +++ b/drivers/net/xen-netback/xenbus.c
> @@ -935,7 +935,7 @@ static void connect(struct backend_info *be)
>  					"multi-queue-num-queues", 1);
>  	if (requested_num_queues > xenvif_max_queues) {
>  		/* buggy or malicious guest */
> -		xenbus_dev_fatal(dev, err,
> +		xenbus_dev_fatal(dev, -EINVAL,
>  				 "guest requested %u queues, exceeding the
> maximum of %u.",
>  				 requested_num_queues,
> xenvif_max_queues);
>  		return;
> --
> 2.9.0

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

* Re: [Xen PATCH] xen-netback: fix error handling output
  2016-11-08 13:34 [Xen PATCH] xen-netback: fix error handling output Arnd Bergmann
  2016-11-08 13:40 ` Paul Durrant
@ 2016-11-10  1:29 ` David Miller
  2016-11-10  9:14 ` Juergen Gross
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-11-10  1:29 UTC (permalink / raw)
  To: arnd
  Cc: david.vrabel, wei.liu2, paul.durrant, jgross, filipe.manco,
	xen-devel, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Tue,  8 Nov 2016 14:34:34 +0100

> The connect function prints an unintialized error code after an
> earlier initialization was removed:
> 
> drivers/net/xen-netback/xenbus.c: In function 'connect':
> drivers/net/xen-netback/xenbus.c:938:3: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This prints it as -EINVAL instead, which seems to be the most
> appropriate error code. Before the patch that caused the warning,
> this would print a positive number returned by vsscanf() instead,
> which is also wrong. We probably don't need a backport though,
> as fixing the warning here should be sufficient.
> 
> Fixes: f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
> Fixes: 8d3d53b3e433 ("xen-netback: Add support for multiple queues")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

That first Fixes: commit mentioned is in neither of my trees, so I
assume it is in the Xen tree and thus this fix should get applied
there.

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

* Re: [Xen PATCH] xen-netback: fix error handling output
  2016-11-08 13:34 [Xen PATCH] xen-netback: fix error handling output Arnd Bergmann
  2016-11-08 13:40 ` Paul Durrant
  2016-11-10  1:29 ` David Miller
@ 2016-11-10  9:14 ` Juergen Gross
  2 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2016-11-10  9:14 UTC (permalink / raw)
  To: Arnd Bergmann, David Vrabel
  Cc: Wei Liu, Paul Durrant, David S. Miller, Filipe Manco, xen-devel,
	netdev, linux-kernel

On 08/11/16 14:34, Arnd Bergmann wrote:
> The connect function prints an unintialized error code after an
> earlier initialization was removed:
> 
> drivers/net/xen-netback/xenbus.c: In function 'connect':
> drivers/net/xen-netback/xenbus.c:938:3: error: 'err' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> This prints it as -EINVAL instead, which seems to be the most
> appropriate error code. Before the patch that caused the warning,
> this would print a positive number returned by vsscanf() instead,
> which is also wrong. We probably don't need a backport though,
> as fixing the warning here should be sufficient.
> 
> Fixes: f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
> Fixes: 8d3d53b3e433 ("xen-netback: Add support for multiple queues")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied to xen/tip.git for-linus-4.10


Thanks,

Juergen

> ---
>  drivers/net/xen-netback/xenbus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
> index 7356e00fac54..bfed79877b8a 100644
> --- a/drivers/net/xen-netback/xenbus.c
> +++ b/drivers/net/xen-netback/xenbus.c
> @@ -935,7 +935,7 @@ static void connect(struct backend_info *be)
>  					"multi-queue-num-queues", 1);
>  	if (requested_num_queues > xenvif_max_queues) {
>  		/* buggy or malicious guest */
> -		xenbus_dev_fatal(dev, err,
> +		xenbus_dev_fatal(dev, -EINVAL,
>  				 "guest requested %u queues, exceeding the maximum of %u.",
>  				 requested_num_queues, xenvif_max_queues);
>  		return;
> 

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

end of thread, other threads:[~2016-11-10  9:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 13:34 [Xen PATCH] xen-netback: fix error handling output Arnd Bergmann
2016-11-08 13:40 ` Paul Durrant
2016-11-10  1:29 ` David Miller
2016-11-10  9:14 ` Juergen Gross

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