diff mbox

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

Message ID 577E258502000078000FBE6F@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich July 7, 2016, 7:48 a.m. UTC
Only a positive return value indicates success.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
 drivers/video/fbdev/xen-fbfront.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)




--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Vrabel July 7, 2016, 9:46 a.m. UTC | #1
On 07/07/16 08:48, Jan Beulich wrote:
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> ---
>  drivers/video/fbdev/xen-fbfront.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- 4.7-rc6-xenbus_scanf.orig/drivers/video/fbdev/xen-fbfront.c
> +++ 4.7-rc6-xenbus_scanf/drivers/video/fbdev/xen-fbfront.c
> @@ -658,13 +658,13 @@ InitWait:
>  			goto InitWait; /* no InitWait seen yet, fudge it */
>  
>  		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
> -				 "request-update", "%d", &val) < 0)
> +				 "request-update", "%d", &val) <= 0)
>  			val = 0;
>  		if (val)
>  			info->update_wanted = 1;
>  
>  		if (xenbus_scanf(XBT_NIL, dev->otherend,
> -				 "feature-resize", "%d", &val) < 0)
> +				 "feature-resize", "%d", &val) <= 0)

xenbus_scanf() has:

/* Single read and scanf: returns -errno or num scanned. */
...
        if (ret == 0)
                return -ERANGE;
...

So none of these patches are necessary.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- 4.7-rc6-xenbus_scanf.orig/drivers/video/fbdev/xen-fbfront.c
+++ 4.7-rc6-xenbus_scanf/drivers/video/fbdev/xen-fbfront.c
@@ -658,13 +658,13 @@  InitWait:
 			goto InitWait; /* no InitWait seen yet, fudge it */
 
 		if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-				 "request-update", "%d", &val) < 0)
+				 "request-update", "%d", &val) <= 0)
 			val = 0;
 		if (val)
 			info->update_wanted = 1;
 
 		if (xenbus_scanf(XBT_NIL, dev->otherend,
-				 "feature-resize", "%d", &val) < 0)
+				 "feature-resize", "%d", &val) <= 0)
 			val = 0;
 		info->feature_resize = val;
 		break;