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:   Wed, 1 Aug 2018 20:08:07 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Ivan Bornyakov <brnkv.i1@...il.com>
Cc:     devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        benchan@...omium.org, jnjoseph@...gle.com, rspringer@...gle.com
Subject: Re: [PATCH] staging: gasket: sysfs: fix potential null dereference

On Tue, Jul 31, 2018 at 06:23:20PM +0300, Ivan Bornyakov wrote:
> Add handling of possible allocation failure.
> 
> Reported by smatch:
> 
>   drivers/staging/gasket/gasket_sysfs.c:105 put_mapping() error: potential null dereference 'files_to_remove'. (kcalloc returns null)
> 
> Signed-off-by: Ivan Bornyakov <brnkv.i1@...il.com>
> ---
>  drivers/staging/gasket/gasket_sysfs.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/staging/gasket/gasket_sysfs.c b/drivers/staging/gasket/gasket_sysfs.c
> index ef4eca02afa6..682e5c21f203 100644
> --- a/drivers/staging/gasket/gasket_sysfs.c
> +++ b/drivers/staging/gasket/gasket_sysfs.c
> @@ -101,6 +101,12 @@ static void put_mapping(struct gasket_sysfs_mapping *mapping)
>  		files_to_remove = kcalloc(num_files_to_remove,
>  					  sizeof(*files_to_remove),
>  					  GFP_KERNEL);
> +		if (!files_to_remove) {
> +			pr_err("%s: can't allocate memory\n", __func__);

kcalloc failing will print something, no need to do it again here.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ