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: <567AE34E.9000008@users.sourceforge.net>
Date:	Wed, 23 Dec 2015 19:09:18 +0100
From:	SF Markus Elfring <elfring@...rs.sourceforge.net>
To:	linux-ntfs-dev@...ts.sourceforge.net, linux-block@...r.kernel.org,
	Jens Axboe <axboe@...nel.dk>, Richard Russon <ldm@...tcap.org>
Cc:	Julia Lawall <julia.lawall@...6.fr>,
	LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org
Subject: [PATCH 2/5] block-LDM: Delete extra log messages for memory
 allocation failures

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 23 Dec 2015 13:21:01 +0100

A failed call of the kmalloc() function can generate appropriate
information about insufficient memory already.
Thus remove unnecessary log messages for such failures.

Suggested-by: Julia Lawall <julia.lawall@...6.fr>
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 block/partitions/ldm.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c
index a50385c..856658a 100644
--- a/block/partitions/ldm.c
+++ b/block/partitions/ldm.c
@@ -343,10 +343,8 @@ static bool ldm_validate_privheads(struct parsed_partitions *state,
 
 	ph[1] = kmalloc (sizeof (*ph[1]), GFP_KERNEL);
 	ph[2] = kmalloc (sizeof (*ph[2]), GFP_KERNEL);
-	if (!ph[1] || !ph[2]) {
-		ldm_crit ("Out of memory.");
+	if (!ph[1] || !ph[2])
 		goto out;
-	}
 
 	/* off[1 & 2] are relative to ph[0]->config_start */
 	ph[0]->config_start = 0;
@@ -431,10 +429,8 @@ static bool ldm_validate_tocblocks(struct parsed_partitions *state,
 	ph = &ldb->ph;
 	tb[0] = &ldb->toc;
 	tb[1] = kmalloc(sizeof(*tb[1]) * 3, GFP_KERNEL);
-	if (!tb[1]) {
-		ldm_crit("Out of memory.");
+	if (!tb[1])
 		return false;
-	}
 	tb[2] = (struct tocblock*)((u8*)tb[1] + sizeof(*tb[1]));
 	tb[3] = (struct tocblock*)((u8*)tb[2] + sizeof(*tb[2]));
 	/*
@@ -1239,10 +1235,8 @@ static bool ldm_ldmdb_add (u8 *data, int len, struct ldmdb *ldb)
 	BUG_ON (!data || !ldb);
 
 	vb = kmalloc (sizeof (*vb), GFP_KERNEL);
-	if (!vb) {
-		ldm_crit ("Out of memory.");
+	if (!vb)
 		return false;
-	}
 
 	if (!ldm_parse_vblk (data, len, vb)) {
 		kfree(vb);
@@ -1325,10 +1319,8 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags)
 	}
 
 	f = kmalloc (sizeof (*f) + size*num, GFP_KERNEL);
-	if (!f) {
-		ldm_crit ("Out of memory.");
+	if (!f)
 		return false;
-	}
 
 	f->group = group;
 	f->num   = num;
@@ -1519,10 +1511,8 @@ int ldm_partition(struct parsed_partitions *state)
 		return 0;
 
 	ldb = kmalloc (sizeof (*ldb), GFP_KERNEL);
-	if (!ldb) {
-		ldm_crit ("Out of memory.");
+	if (!ldb)
 		goto out;
-	}
 
 	/* Parse and check privheads. */
 	if (!ldm_validate_privheads(state, &ldb->ph))
-- 
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