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, 23 Dec 2015 11:41:47 +0100 (CET)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>
cc:	linux-ntfs-dev@...ts.sourceforge.net, linux-block@...r.kernel.org,
	Jens Axboe <axboe@...nel.dk>, Richard Russon <ldm@...tcap.org>,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] block-LDM: One function call less in ldm_validate_tocblocks()
 after error detection



On Wed, 23 Dec 2015, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 22 Dec 2015 22:32:07 +0100
>
> This issue was detected by using the Coccinelle software.
>
> Let us return directly if a memory allocation failed.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  block/partitions/ldm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
> index e507cfb..a50385c 100644
> --- a/block/partitions/ldm.c
> +++ b/block/partitions/ldm.c
> @@ -433,7 +433,7 @@ static bool ldm_validate_tocblocks(struct parsed_partitions *state,
>  	tb[1] = kmalloc(sizeof(*tb[1]) * 3, GFP_KERNEL);
>  	if (!tb[1]) {
>  		ldm_crit("Out of memory.");
> -		goto err;
> +		return false;

The ldm_crit, which is just a printk, is also not necessary, because
kmalloc already generates backtrace information on failure.  So you could
clean up the whole thing at once.

julia

>  	}
>  	tb[2] = (struct tocblock*)((u8*)tb[1] + sizeof(*tb[1]));
>  	tb[3] = (struct tocblock*)((u8*)tb[2] + sizeof(*tb[2]));
> --
> 2.6.3
>
>
--
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