[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xen-netfront: correct return value checks on xenbus_scanf()



Only a positive return value indicates success.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.