Skip to contentSkip to conversation

xen-scsifront: correct return value checks on xenbus_scanf()

PATCH Juergen Gross 1 participant 2 messages Jul 7, 2016 1 message not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Juergen Gross

author Acked-by
#1 lore raw
Quoted 3 lines · Jan Beulich

Only a positive return value indicates success.

Quoted 25 lines
---
 drivers/scsi/xen-scsifront.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/xen-scsifront.c +2 -2
@@ -1000,14 +1000,14 @@ static void scsifront_do_lun_hotplug(str
 		snprintf(str, sizeof(str), "vscsi-devs/%s/state", dir[i]);
 		err = xenbus_scanf(XBT_NIL, dev->otherend, str, "%u",
 				   &device_state);
-		if (XENBUS_EXIST_ERR(err))
+		if (err <= 0)
 			continue;
 
 		/* virtual SCSI device */
 		snprintf(str, sizeof(str), "vscsi-devs/%s/v-dev", dir[i]);
 		err = xenbus_scanf(XBT_NIL, dev->otherend, str,
 				   "%u:%u:%u:%u", &hst, &chn, &tgt, &lun);
-		if (XENBUS_EXIST_ERR(err))
+		if (err != 4)
 			continue;
 
 		/*
author Acked-by
#2 lore raw
In reply to a message not in the archive
Quoted 3 lines · Jan Beulich

Only a positive return value indicates success.

Quoted 15 lines
---
 drivers/scsi/xen-scsifront.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/xen-scsifront.c +1 -1
@@ -1000,14 +1000,14 @@ static void scsifront_do_lun_hotplug(str
 		snprintf(str, sizeof(str), "vscsi-devs/%s/state", dir[i]);
 		err = xenbus_scanf(XBT_NIL, dev->otherend, str, "%u",
 				   &device_state);
-		if (XENBUS_EXIST_ERR(err))
+		if (err <= 0)
 			continue;

drivers/scsi/xen-scsifront.c static void scsifront_do_lun_hotplug(str · line 1013

Quoted 10 lines
drivers/scsi/xen-scsifront.c +1 -1
 
 		/* virtual SCSI device */
 		snprintf(str, sizeof(str), "vscsi-devs/%s/v-dev", dir[i]);
 		err = xenbus_scanf(XBT_NIL, dev->otherend, str,
 				   "%u:%u:%u:%u", &hst, &chn, &tgt, &lun);
-		if (XENBUS_EXIST_ERR(err))
+		if (err != 4)
 			continue;
 
 		/*

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