lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 19 Oct 2015 15:30:45 +0100
From:	Julien Grall <julien.grall@...rix.com>
To:	Insu Yun <wuninsu@...il.com>, <dmitry.torokhov@...il.com>,
	<stefano.stabellini@...citrix.com>, <david.vrabel@...rix.com>,
	<wei.liu2@...rix.com>, <linux-input@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
CC:	<taesoo@...ech.edu>, <yeongjin.jang@...ech.edu>, <insu@...ech.edu>,
	<changwoo@...ech.edu>
Subject: Re: [PATCH] xen: check return value of xenbus_printf

Hi,

On 19/10/15 15:10, 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.
> 
> Signed-off-by: Insu Yun <wuninsu@...il.com>
> ---
>  drivers/input/misc/xen-kbdfront.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
> index 23d0549..9d465d7 100644
> --- a/drivers/input/misc/xen-kbdfront.c
> +++ b/drivers/input/misc/xen-kbdfront.c
> @@ -129,8 +129,14 @@ 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");

The second line of arguments should be aligned to the first parameter. I.e:

xenbus_printf(XBT_NIL, dev->nodename,
              "request-abs-pointer", "1");

See an example in xenkbd_backend_changed.

With that fixed:

Reviewed-by: Julien Grall <julien.grall@...rix.com>

> +		if (ret) {
> +			pr_warning("xenkbd: can't request abs-pointer");

Note that checkpatch.pl will print a warning here:

WARNING: Prefer pr_warn(... to pr_warning(...
#27: FILE: drivers/input/misc/xen-kbdfront.c:136:
+                       pr_warning("xenkbd: can't request abs-pointer");


Although, I'm fine if you don't fix this one.

> +			abs = 0;
> +		}
> +	}
>  
>  	/* keyboard */
>  	kbd = input_allocate_device();
> 

Regards,

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ