Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247972 > unrolled thread

[PATCH] xen: check return value of xenbus_printf

Started byInsu Yun <wuninsu@gmail.com>
First post2015-10-15 18:30 +0200
Last post2015-10-15 20:30 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] xen: check return value of xenbus_printf Insu Yun <wuninsu@gmail.com> - 2015-10-15 18:30 +0200
    Re: [PATCH] xen: check return value of xenbus_printf David Vrabel <david.vrabel@citrix.com> - 2015-10-15 18:50 +0200
      Re: [PATCH] xen: check return value of xenbus_printf Julien Grall <julien.grall@citrix.com> - 2015-10-15 20:30 +0200

#1247972 — [PATCH] xen: check return value of xenbus_printf

FromInsu Yun <wuninsu@gmail.com>
Date2015-10-15 18:30 +0200
Subject[PATCH] xen: check return value of xenbus_printf
Message-ID<qjTzI-3md-9@gated-at.bofh.it>
Internally, xenbus_printf uses memory allocation, so it can be failed in
memory pressure.Therefore, xenbus_printf's return should be checked 
and properly handled.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 drivers/input/misc/xen-kbdfront.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 23d0549..a3b0940 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -129,8 +129,11 @@ static int xenkbd_probe(struct xenbus_device *dev,
 
 	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
 		abs = 0;
-	if (abs)
-		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+	if (abs) {
+		ret = xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
+		if (ret)
+			pr_warning("xenkbd: can't request abs-pointer");
+  }
 
 	/* keyboard */
 	kbd = input_allocate_device();
-- 
1.9.1

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

[toc] | [next] | [standalone]


#1248001

FromDavid Vrabel <david.vrabel@citrix.com>
Date2015-10-15 18:50 +0200
Message-ID<qjTT4-3IL-15@gated-at.bofh.it>
In reply to#1247972
On 15/10/15 17:25, Insu Yun wrote:
> Internally, xenbus_printf uses memory allocation, so it can be failed in
> memory pressure.Therefore, xenbus_printf's return should be checked 
> and properly handled.
[...]
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -129,8 +129,11 @@ static int xenkbd_probe(struct xenbus_device *dev,
>  
>  	if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
>  		abs = 0;
> -	if (abs)
> -		xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
> +	if (abs) {
> +		ret = xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
> +		if (ret)
> +			pr_warning("xenkbd: can't request abs-pointer");

I think you want abs = 0 here or input device will be configured as
absolute but the backend will supply relative coordinates.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1248064

FromJulien Grall <julien.grall@citrix.com>
Date2015-10-15 20:30 +0200
Message-ID<qjVrQ-65I-7@gated-at.bofh.it>
In reply to#1248001
Hi Insu,

On 15/10/15 19:12, Insu Yun wrote:
> 
> 
> On Thu, Oct 15, 2015 at 12:40 PM, David Vrabel <david.vrabel@citrix.com
> <mailto:david.vrabel@citrix.com>> wrote:
> 
>     On 15/10/15 17:25, Insu Yun wrote:
>     > Internally, xenbus_printf uses memory allocation, so it can be failed in
>     > memory pressure.Therefore, xenbus_printf's return should be checked
>     > and properly handled.
>     [...]
>     > --- a/drivers/input/misc/xen-kbdfront.c
>     > +++ b/drivers/input/misc/xen-kbdfront.c
>     > @@ -129,8 +129,11 @@ static int xenkbd_probe(struct xenbus_device *dev,
>     >
>     >       if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
>     >               abs = 0;
>     > -     if (abs)
>     > -             xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
>     > +     if (abs) {
>     > +             ret = xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", "1");
>     > +             if (ret)
> 
>     > +                     pr_warning("xenkbd: can't request abs-pointer");
> 
> 
> This error handling is from other code .
> I am not sure that it is right error handling.
>  
> 
> 
>     I think you want abs = 0 here or input device will be configured as
>     absolute but the backend will supply relative coordinates.
> 
> 
> I cannot understand

If the frontend is not able to write the node "request-abs-pointer" in
the xenstore, the backend will always supply relative coordinates.

Although, as abs = 1, the frontend will be configured to handle absolute
coordinate. So the backend and frontend won't be able to understand each
other.

So you have to set abs to 0 if xebus_printf fails.

Regards,

-- 
Julien Grall
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web