From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752092AbbJOSVo (ORCPT ); Thu, 15 Oct 2015 14:21:44 -0400 Received: from smtp.citrix.com ([66.165.176.89]:59804 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939AbbJOSVn (ORCPT ); Thu, 15 Oct 2015 14:21:43 -0400 X-IronPort-AV: E=Sophos;i="5.17,686,1437436800"; d="scan'208";a="306770388" Message-ID: <561FEE60.7080308@citrix.com> Date: Thu, 15 Oct 2015 19:20:16 +0100 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: Insu Yun , David Vrabel CC: Dmitry Torokhov , Wei Liu , Stefano Stabellini , , , , Taesoo Kim , Yeongjin Jang , "Yun, Insu" Subject: Re: [PATCH] xen: check return value of xenbus_printf References: <1444926315-29106-1-git-send-email-wuninsu@gmail.com> <561FD717.9090807@citrix.com> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Insu, On 15/10/15 19:12, Insu Yun wrote: > > > On Thu, Oct 15, 2015 at 12:40 PM, David Vrabel > 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