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]
Date:	Mon, 26 May 2014 17:33:53 +0200
From:	David Herrmann <dh.herrmann@...il.com>
To:	Benoit Taine <benoit.taine@...6.fr>
Cc:	David Herrmann <dh.herrmann@...glemail.com>,
	Jiri Kosina <jkosina@...e.cz>,
	"open list:HID CORE LAYER" <linux-input@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH 16/18] HID: uhid: Use kmemdup instead of kmalloc + memcpy

Hi

On Mon, May 26, 2014 at 5:21 PM, Benoit Taine <benoit.taine@...6.fr> wrote:
> This issue was reported by coccicheck using the semantic patch
> at scripts/coccinelle/api/memdup.cocci
>
> Signed-off-by: Benoit Taine <benoit.taine@...6.fr>

Reviewed-by: David Herrmann <dh.herrmann@...il.com>

Thanks
David

> ---
> Tested by compilation without errors.
>
>  drivers/hid/uhid.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
> index 0d078c3..0cb92e3 100644
> --- a/drivers/hid/uhid.c
> +++ b/drivers/hid/uhid.c
> @@ -441,12 +441,11 @@ static int uhid_dev_create2(struct uhid_device *uhid,
>         if (uhid->rd_size <= 0 || uhid->rd_size > HID_MAX_DESCRIPTOR_SIZE)
>                 return -EINVAL;
>
> -       uhid->rd_data = kmalloc(uhid->rd_size, GFP_KERNEL);
> +       uhid->rd_data = kmemdup(ev->u.create2.rd_data, uhid->rd_size,
> +                               GFP_KERNEL);
>         if (!uhid->rd_data)
>                 return -ENOMEM;
>
> -       memcpy(uhid->rd_data, ev->u.create2.rd_data, uhid->rd_size);
> -
>         hid = hid_allocate_device();
>         if (IS_ERR(hid)) {
>                 ret = PTR_ERR(hid);
>
--
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