public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] partitions/efi.c: replace useless kzalloc's by kmalloc's
@ 2013-04-29 21:00 Philippe De Muyter
  2013-04-30  6:34 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe De Muyter @ 2013-04-29 21:00 UTC (permalink / raw)
  To: linux-kernel
  Cc: Philippe De Muyter, Matt Domsch, Panagiotis Issaris, Jens Axboe,
	Andrew Morton

In alloc_read_gpt_entries and alloc_read_gpt_header, the kzalloc'ated
zones are either totally overwritten by the following read_lba call,
or freed.  As kmalloc is cheaper than kzalloc, use kmalloc.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Panagiotis Issaris <takis@issaris.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 block/partitions/efi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index ff5804e..c85fc89 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -238,7 +238,7 @@ static gpt_entry *alloc_read_gpt_entries(struct parsed_partitions *state,
                 le32_to_cpu(gpt->sizeof_partition_entry);
 	if (!count)
 		return NULL;
-	pte = kzalloc(count, GFP_KERNEL);
+	pte = kmalloc(count, GFP_KERNEL);
 	if (!pte)
 		return NULL;
 
@@ -267,7 +267,7 @@ static gpt_header *alloc_read_gpt_header(struct parsed_partitions *state,
 	gpt_header *gpt;
 	unsigned ssz = bdev_logical_block_size(state->bdev);
 
-	gpt = kzalloc(ssz, GFP_KERNEL);
+	gpt = kmalloc(ssz, GFP_KERNEL);
 	if (!gpt)
 		return NULL;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] partitions/efi.c: replace useless kzalloc's by kmalloc's
  2013-04-29 21:00 [PATCH] partitions/efi.c: replace useless kzalloc's by kmalloc's Philippe De Muyter
@ 2013-04-30  6:34 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2013-04-30  6:34 UTC (permalink / raw)
  To: Philippe De Muyter
  Cc: linux-kernel, Matt Domsch, Panagiotis Issaris, Andrew Morton

On Mon, Apr 29 2013, Philippe De Muyter wrote:
> In alloc_read_gpt_entries and alloc_read_gpt_header, the kzalloc'ated
> zones are either totally overwritten by the following read_lba call,
> or freed.  As kmalloc is cheaper than kzalloc, use kmalloc.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-30  6:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-29 21:00 [PATCH] partitions/efi.c: replace useless kzalloc's by kmalloc's Philippe De Muyter
2013-04-30  6:34 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox