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] [thread-next>] [day] [month] [year] [list]
Message-ID: <c3ecb2d9-55eb-fc74-a08a-bbd5c5018cb8@codeaurora.org>
Date:   Thu, 28 Mar 2019 18:41:50 +0530
From:   Mukesh Ojha <mojha@...eaurora.org>
To:     Bartosz Golaszewski <brgl@...ev.pl>,
        Linus Walleij <linus.walleij@...aro.org>
Cc:     linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH] gpio: mockup: use simple_read_from_buffer() in debugfs
 read callback


On 3/28/2019 4:30 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@...libre.com>
>
> Calling read() for a single byte read will return 2 currently. Use
> simple_read_from_buffer() which correctly handles all sizes.
>
> Fixes: 2a9e27408e12 ("gpio: mockup: rework debugfs interface")
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> ---
>   drivers/gpio/gpio-mockup.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index 74ba8b1d71d8..859585dce5c9 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -219,12 +219,7 @@ static ssize_t gpio_mockup_debugfs_read(struct file *file,
>   	val = gpio_mockup_get(gc, priv->offset);
>   	cnt = snprintf(buf, sizeof(buf), "%d\n", val);


why \n is inserted in the buf..

rv variable is unused now.

>   
> -	rv = copy_to_user(usr_buf, buf, cnt);
> -	if (rv)
> -		return rv;
> -
> -	*ppos += cnt;
> -	return cnt;
> +	return simple_read_from_buffer(usr_buf, size, ppos, buf, cnt);



Looks good to me.
Remove the unused variable.

Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>

-Mukesh

>   }
>   
>   static ssize_t gpio_mockup_debugfs_write(struct file *file,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ