[U-Boot] [PATCH] Revert "part: Allocate only one legacy_mbr buffer"

Alexey Brodkin Alexey.Brodkin at synopsys.com
Wed Sep 4 10:12:45 UTC 2019


Hi Faiz,

> -----Original Message-----
> From: Faiz Abbas <faiz_abbas at ti.com>
> Sent: Wednesday, September 4, 2019 12:22 PM
> To: u-boot at lists.denx.de
> Cc: paulemge at forallsecure.com; faiz_abbas at ti.com; Alexey Brodkin <abrodkin at synopsys.com>;
> trini at konsulko.com
> Subject: [PATCH] Revert "part: Allocate only one legacy_mbr buffer"
> 
> This reverts commit 8639e34d2c5e12cc2e45c95b1a2e97c22bf6a711.
> 
> The blk_dread() call following the allocation will read one block from
> the device. This will lead to overflow if the blocksize is greater than
> the size of legacy_mbr. Fix this by allocating one block size.

Did you read justification of my change that you're reverting now?
With your change in place we'll allocate a buffer
of size = (sizeof(legacy_mbr) * dev_desc->blksz).

Is that something you really want?

I guess what you really want to do is to allocate buffer for "mbr"
dynamically of size which is max(sizeof(legacy_mbr), dev_desc->blksz).

-Alexey 



More information about the U-Boot mailing list