[PATCH 19/26] partitions: dos: allocate correctly sized buffer for dos_partition_desc
Ahmad Fatoum <[email protected]> Fri, 26 Jun 2026 10:42:30 +0200
| Newsgroups | org.infradead.lists.barebox |
|---|---|
| Message-ID | <[email protected]> |
512 bytes is likely more than was ever required for this struct. Allocate instead exactly as many bytes as needed. Assisted-by: Codex:gpt-5.5 Signed-off-by: Ahmad Fatoum <[email protected]> --- common/partitions/dos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/partitions/dos.c b/common/partitions/dos.c index ce2e21357d52..1526b97dec67 100644 --- a/common/partitions/dos.c +++ b/common/partitions/dos.c @@ -318,7 +318,7 @@ static void dos_partition_free(struct partition_desc *pd) static __maybe_unused struct partition_desc *dos_partition_create_table(struct block_device *blk) { - struct dos_partition_desc *dpd = xzalloc(512); + struct dos_partition_desc *dpd = xzalloc(sizeof(*dpd)); partition_desc_init(&dpd->pd, blk); -- 2.47.3