[U-Boot] [PATCH 1/1] GPT: incomplete initialization in allocate_disk_part
Simon Glass
sjg at chromium.org
Mon Sep 25 02:14:33 UTC 2017
On 21 September 2017 at 23:24, Stefan Roese <sr at denx.de> wrote:
> On 21.09.2017 19:03, Heinrich Schuchardt wrote:
>>
>> memset(newpart, '\0', sizeof(newpart));
>> only initializes the firest 4 or 8 bytes of *newpart and not the whole
>> structure disk_part.
>>
>> We should use sizeof(struct disk_part).
>>
>> Instead of malloc and memset we can use calloc.
>>
>> Identified by cppcheck.
>>
>> Fixes: 09a49930e41 GPT: read partition table from device into a data
>> structure
>> Cc: Stefan Roese <sr at denx.de>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>> v2
>> use calloc as suggested by Stefan
>> ---
>> cmd/gpt.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list