xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen-netfront: correct return value checks on xenbus_scanf()
@ 2016-07-07  7:59 Jan Beulich
  2016-07-07  9:56 ` David Vrabel
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2016-07-07  7:59 UTC (permalink / raw)
  To: david.vrabel, boris.ostrovsky, Juergen Gross; +Cc: xen-devel, netdev

Only a positive return value indicates success.

Signed-off-by: Jan Beulich <jbeulich@suse.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. */




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: [PATCH] xen-netfront: correct return value checks on xenbus_scanf()
  2016-07-07  7:59 [PATCH] xen-netfront: correct return value checks on xenbus_scanf() Jan Beulich
@ 2016-07-07  9:56 ` David Vrabel
  0 siblings, 0 replies; 2+ messages in thread
From: David Vrabel @ 2016-07-07  9:56 UTC (permalink / raw)
  To: Jan Beulich, david.vrabel, boris.ostrovsky, Juergen Gross
  Cc: xen-devel, netdev

On 07/07/16 08:59, Jan Beulich wrote:
> Only a positive return value indicates success.

This checks were already correct.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-07-07  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07  7:59 [PATCH] xen-netfront: correct return value checks on xenbus_scanf() Jan Beulich
2016-07-07  9:56 ` David Vrabel

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