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:   Tue, 23 Aug 2016 06:50:30 -0400
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Sudip Mukherjee <sudipm.mukherjee@...il.com>
Cc:     devel@...verdev.osuosl.org, Fengguang Wu <fengguang.wu@...el.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: i4l: icn: use memdup_user

On Tue, Aug 23, 2016 at 03:57:34PM +0530, Sudip Mukherjee wrote:
> Its better to use memdup_user which does the same thing which this
> code has implemented.
> 
> Suggested-by: Fengguang Wu <fengguang.wu@...el.com>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.co.uk>
> ---
>  drivers/staging/i4l/icn/icn.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/i4l/icn/icn.c b/drivers/staging/i4l/icn/icn.c
> index b2f4055..5312675 100644
> --- a/drivers/staging/i4l/icn/icn.c
> +++ b/drivers/staging/i4l/icn/icn.c
> @@ -804,21 +804,16 @@ static int
>  icn_loadboot(u_char __user *buffer, icn_card *card)
>  {
>  	int ret;
> -	u_char *codebuf;
> +	void *codebuf;

why did you change the type here?


>  	unsigned long flags;
>  
>  #ifdef BOOT_DEBUG
>  	printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) buffer);
>  #endif
> -	codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
> -	if (!codebuf) {
> -		printk(KERN_WARNING "icn: Could not allocate code buffer\n");
> -		ret = -ENOMEM;
> -		goto out;
> -	}
> -	if (copy_from_user(codebuf, buffer, ICN_CODE_STAGE1)) {
> -		ret = -EFAULT;
> -		goto out_kfree;
> +	codebuf = memdup_user(buffer, ICN_CODE_STAGE1);
> +	if (IS_ERR(codebuf)) {
> +		pr_warn("icn: Could not allocate code buffer\n");

Don't warn about something that already was warned about.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ