All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Revert "part: Allocate only one legacy_mbr buffer"
@ 2019-09-04  9:22 Faiz Abbas
  2019-09-04 10:12 ` Alexey Brodkin
  0 siblings, 1 reply; 12+ messages in thread
From: Faiz Abbas @ 2019-09-04  9:22 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
---
 disk/part_dos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index aae9d95906..24d23ad247 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -93,7 +93,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, 1);
+	ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr, dev_desc->blksz);
 
 	if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1)
 		return -1;
-- 
2.19.2

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

end of thread, other threads:[~2019-09-04 14:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04  9:22 [U-Boot] [PATCH] Revert "part: Allocate only one legacy_mbr buffer" Faiz Abbas
2019-09-04 10:12 ` Alexey Brodkin
2019-09-04 11:43   ` Faiz Abbas
2019-09-04 11:46     ` Alexey Brodkin
2019-09-04 12:49       ` Faiz Abbas
2019-09-04 12:57         ` Alexey Brodkin
2019-09-04 13:09           ` Faiz Abbas
2019-09-04 13:23             ` Alexey Brodkin
2019-09-04 13:46               ` Alexey Brodkin
2019-09-04 13:49                 ` Tom Rini
2019-09-04 14:07                   ` Faiz Abbas
2019-09-04 14:08               ` Faiz Abbas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.