Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297302

[PATCH] block-LDM: One function call less in ldm_validate_tocblocks() after error detection

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH] block-LDM: One function call less in ldm_validate_tocblocks() after error detection
Date 2015-12-23 10:50 +0100
Message-ID <qIOds-7UY-5@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.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@users.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;
 	}
 	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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] block-LDM: One function call less in ldm_validate_tocblocks()  after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 10:50 +0100
  Re: [PATCH] block-LDM: One function call less in ldm_validate_tocblocks()  after error detection Julia Lawall <julia.lawall@lip6.fr> - 2015-12-23 11:50 +0100
    [PATCH 0/5] block-LDM: Improvements for exception handling SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 19:10 +0100
      [PATCH 1/5] block-LDM: One function call less in  ldm_validate_tocblocks() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 19:10 +0100
      [PATCH 2/5] block-LDM: Delete extra log messages for memory  allocation failures SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 19:10 +0100
      [PATCH 3/5] block-LDM: One function call less in ldm_partition()  after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 19:20 +0100
      [PATCH 5/5] block-LDM: Fine-tuning for the source code formatting SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 19:20 +0100
      [PATCH 4/5] block-LDM: Less function calls in  ldm_validate_privheads() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-23 19:20 +0100

csiph-web