2013-04-29 21:01:07

by Philippe De Muyter

[permalink] [raw]
Subject: [PATCH] partitions/efi.c: replace useless kzalloc's by kmalloc's

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 <[email protected]>
Cc: Matt Domsch <[email protected]>
Cc: Panagiotis Issaris <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Andrew Morton <[email protected]>
---
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


2013-04-30 06:34:18

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] partitions/efi.c: replace useless kzalloc's by kmalloc's

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