lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 07 Jul 2016 01:59:32 -0600
From:	"Jan Beulich" <JBeulich@...e.com>
To:	<david.vrabel@...rix.com>, <boris.ostrovsky@...cle.com>,
	"Juergen Gross" <JGross@...e.com>
Cc:	<xen-devel@...ts.xenproject.org>, <netdev@...r.kernel.org>
Subject: [PATCH] xen-netfront: correct return value checks on
 xenbus_scanf()

Only a positive return value indicates success.

Signed-off-by: Jan Beulich <jbeulich@...e.com>
---
 drivers/net/xen-netfront.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- 4.7-rc6-xenbus_scanf.orig/drivers/net/xen-netfront.c
+++ 4.7-rc6-xenbus_scanf/drivers/net/xen-netfront.c
@@ -1158,7 +1158,7 @@ static netdev_features_t xennet_fix_feat
 
 	if (features & NETIF_F_SG) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend, "feature-sg",
-				 "%d", &val) < 0)
+				 "%d", &val) <= 0)
 			val = 0;
 
 		if (!val)
@@ -1167,7 +1167,7 @@ static netdev_features_t xennet_fix_feat
 
 	if (features & NETIF_F_IPV6_CSUM) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
-				 "feature-ipv6-csum-offload", "%d", &val) < 0)
+				 "feature-ipv6-csum-offload", "%d", &val) <= 0)
 			val = 0;
 
 		if (!val)
@@ -1176,7 +1176,7 @@ static netdev_features_t xennet_fix_feat
 
 	if (features & NETIF_F_TSO) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
-				 "feature-gso-tcpv4", "%d", &val) < 0)
+				 "feature-gso-tcpv4", "%d", &val) <= 0)
 			val = 0;
 
 		if (!val)
@@ -1185,7 +1185,7 @@ static netdev_features_t xennet_fix_feat
 
 	if (features & NETIF_F_TSO6) {
 		if (xenbus_scanf(XBT_NIL, np->xbdev->otherend,
-				 "feature-gso-tcpv6", "%d", &val) < 0)
+				 "feature-gso-tcpv6", "%d", &val) <= 0)
 			val = 0;
 
 		if (!val)
@@ -1808,7 +1808,7 @@ static int talk_to_netback(struct xenbus
 	/* Check if backend supports multiple queues */
 	err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
 			   "multi-queue-max-queues", "%u", &max_queues);
-	if (err < 0)
+	if (err <= 0)
 		max_queues = 1;
 	num_queues = min(max_queues, xennet_max_queues);
 
@@ -1816,7 +1816,7 @@ static int talk_to_netback(struct xenbus
 	err = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
 			   "feature-split-event-channels", "%u",
 			   &feature_split_evtchn);
-	if (err < 0)
+	if (err <= 0)
 		feature_split_evtchn = 0;
 
 	/* Read mac addr. */



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ