[SeaBIOS] [PATCH] boot: Replace hardcoded BEV array size with BUILD_MAX_EXTDRIVE * 3

Mike Banon posted 1 patch 4 days, 4 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/CAK7947mj9BP+=rC1wSjUWKA-hcFP6b1QgRbR=GSnfXURy6is+A@mail.gmail.com
src/boot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[SeaBIOS] [PATCH] boot: Replace hardcoded BEV array size with BUILD_MAX_EXTDRIVE * 3
Posted by Mike Banon 4 days, 4 hours ago
[PATCH] boot: Replace hardcoded BEV array size with BUILD_MAX_EXTDRIVE * 3

The BEV array stores boot entries for floppy, HDD and CDROM drives,
as well as option ROMs and other boot sources. The previous hardcoded
limit of 20 entries was arbitrary and could be exceeded when many
drives are present – especially with the upcoming support for
multiple floppy images.

The max number of drive boot entries is bounded by BUILD_MAX_EXTDRIVE
per drive type. Since there are three drive types, the worst-case
drive-only total is BUILD_MAX_EXTDRIVE * 3. Using this value ensures
that the array cannot overflow due to drives, while still leaving
room for a modest number of option ROM entries in practice.

Signed-off-by: Mike Banon <mikebdp2@gmail.com>
---
 src/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/boot.c b/src/boot.c
index 5c37dafd..18e62a43 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -798,7 +798,7 @@ struct bev_s {
     int type;
     u32 vector;
 };
-static struct bev_s BEV[20];
+static struct bev_s BEV[BUILD_MAX_EXTDRIVE * 3];
 static int BEVCount;
 static int HaveHDBoot, HaveFDBoot;

-- 
2.53.0
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org