Skip to content

Commit

Permalink
part: Allocate only one legacy_mbr buffer
Browse files Browse the repository at this point in the history
Commit ff98cb9 ("part: extract MBR signature from partitions")
blindly switched allocated by ALLOC_CACHE_ALIGN_BUFFER buffer type from
"unsigned char" to "legacy_mbr" which caused allocation of size =
(typeof(legacy_mbr) * dev_desc->blksize) instead of just space enough
for "legacy_mbr" structure.

Signed-off-by: Alexey Brodkin <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Peter Jones <[email protected]>
Cc: Alexander Graf <[email protected]>
Cc: Tom Rini <[email protected]>
  • Loading branch information
abrodkin authored and trini committed Feb 8, 2018
1 parent 6808ef9 commit 8639e34
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion disk/part_dos.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static int test_block_type(unsigned char *buffer)
static int part_test_dos(struct blk_desc *dev_desc)
{
#ifndef CONFIG_SPL_BUILD
ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz);
ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, 1);

if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1)
return -1;
Expand Down

0 comments on commit 8639e34

Please sign in to comment.