Skip to contentSkip to conversation

xen-netback: fix error handling output

PATCH Applied Arnd Bergmann 4 participants 7 messages Nov 8, 2016 – Nov 10, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/xenbus.c +1 -1
index 7356e00fac54..bfed79877b8a 100644
@@ -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;
Signature · 7 lines
2.9.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: 08 November 2016 13:35
To: David Vrabel <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Wei Liu <[email protected]>; Paul Durrant <[email protected]>; David S. Miller <[email protected]>; Juergen Gross <[email protected]>; Filipe Manco <[email protected]>; [email protected]; [email protected]; [email protected]
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.

Quoted 4 lines
Fixes f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-

netback")

Fixes 8d3d53b3e433 ("xen-netback: Add support for multiple queues")

Yes, I'd say EINVAL was most appropriate.

Quoted 18 lines
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen- renamed from drivers/net/xen-netback/xenbus.c +0 -0

netback/xenbus.c
index 7356e00fac54..bfed79877b8a 100644

drivers/net/xen-netback/xenbus.c +1 -1
@@ -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,
Quoted 4 lines

xenvif_max_queues);
return;
--
2.9.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 24 lines

-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: 08 November 2016 13:35
To: David Vrabel <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Wei Liu <[email protected]>; Paul Durrant <[email protected]>; David S. Miller <[email protected]>; Juergen Gross <[email protected]>; Filipe Manco <[email protected]>; [email protected]; [email protected]; [email protected]
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.

Quoted 4 lines
Fixes f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-

netback")

Fixes 8d3d53b3e433 ("xen-netback: Add support for multiple queues")

Yes, I'd say EINVAL was most appropriate.

Quoted 22 lines
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen- renamed from drivers/net/xen-netback/xenbus.c +0 -0

netback/xenbus.c
index 7356e00fac54..bfed79877b8a 100644

drivers/net/xen-netback/xenbus.c +1 -1
@@ -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

maintainer
#3 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Tue, 8 Nov 2016 14:34:34 +0100

Quoted 12 lines

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.

Quoted 3 lines
Fixes f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
Fixes 8d3d53b3e433 ("xen-netback: Add support for multiple queues")

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.

maintainer
#4 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Tue, 8 Nov 2016 14:34:34 +0100

Quoted 12 lines

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.

Quoted 3 lines
Fixes f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
Fixes 8d3d53b3e433 ("xen-netback: Add support for multiple queues")

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

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.

Quoted 3 lines
Fixes f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
Fixes 8d3d53b3e433 ("xen-netback: Add support for multiple queues")

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

Thanks,

Juergen

Quoted 18 lines
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/xenbus.c +1 -1
index 7356e00fac54..bfed79877b8a 100644
@@ -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;
#6 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

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.

Quoted 3 lines
Fixes f95842e7a9f2 ("xen: make use of xenbus_read_unsigned() in xen-netback")
Fixes 8d3d53b3e433 ("xen-netback: Add support for multiple queues")

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

Thanks,

Juergen

Quoted 10 lines
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xen-netback/xenbus.c +0 -0
index 7356e00fac54..bfed79877b8a 100644

drivers/net/xen-netback/xenbus.c static void connect(struct backend_info *be) · line 941

Quoted 8 lines
drivers/net/xen-netback/xenbus.c +1 -1
@@ -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;

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel