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: <568D5CD9.70704@cogentembedded.com>
Date:	Wed, 6 Jan 2016 21:28:41 +0300
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Peter Senna Tschudin <peter.senna@...labora.com>,
	thomas@...ischhofer.net, gregkh@...uxfoundation.org,
	trivial@...nel.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc:	Peter Senna Tschudin <peter.senna@...il.com>
Subject: Re: [PATCH 4/5] usb-misc: sisusbvga: Remove kmalloc logs and fix
 error path

Hello.

On 1/5/2016 7:54 PM, Peter Senna Tschudin wrote:

> From: Peter Senna Tschudin <peter.senna@...il.com>
>
> This patch remove four calls to dev_err() from sisusb_probe() as
> reporting memory allocation failures is redundant:
>
>   - Remove a call to dev_err() that was reporting unsuccesful call to
>     kzalloc().
>
>   - Remove two calls to dev_err() that were reporting unsuccesful calls
>     to kmalloc().
>
>   - Remove a call to dev_err() that was reporting unsuccesful call to
>     kmalloc(), and replace it by code that clean up previously allocated
>     resources and abort the probe with -ENOMEM. Before this modification
>     sisusb->SiS_Pr could be dereferenced even it was null.

    I think the bug fix should be in its own patch. Don't intermix fixes with 
cleanups please.

> Signed-off-by: Peter Senna Tschudin <peter.senna@...labora.com>
> ---
> Tested by compilation only.
>
>   drivers/usb/misc/sisusbvga/sisusb.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
> index 6cce4fb..875e365 100644
> --- a/drivers/usb/misc/sisusbvga/sisusb.c
> +++ b/drivers/usb/misc/sisusbvga/sisusb.c
[...]
>   	/* Allocate our SiS_Pr */
>   	sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL);
>   	if (!sisusb->SiS_Pr) {
> -		dev_err(&sisusb->sisusb_dev->dev, "Failed to allocate SiS_Pr\n");
> +		retval = -ENOMEM;
> +		goto error_4;
>   	}
>   #endif
>

MBR, Sergei

--
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