From 6d1b9adfa92da6ad903544b7497f05462ef8a301 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Sat, 10 Apr 2010 18:04:27 +0000 Subject: [PATCH] Remove magic numbers in print_message_file Create a define instead of using a magic number in print_message_file. Signed-off-by: Anton Blanchard Signed-off-by: Tony Breeds --- second/yaboot.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/second/yaboot.c b/second/yaboot.c index 9075db1..ac63c46 100644 --- a/second/yaboot.c +++ b/second/yaboot.c @@ -58,6 +58,8 @@ #define CONFIG_FILE_NAME "yaboot.conf" #define CONFIG_FILE_MAX 0x8000 /* 32k */ +#define MESSAGE_FILE_MAX 2048 + #ifdef USE_MD5_PASSWORDS #include "md5.h" #endif /* USE_MD5_PASSWORDS */ @@ -295,13 +297,13 @@ void print_message_file(char *filename) } else opened = 1; - msg = malloc(2001); + msg = malloc(MESSAGE_FILE_MAX + 1); if (!msg) goto done; else - memset(msg, 0, 2001); + memset(msg, 0, MESSAGE_FILE_MAX + 1); - if (file.fs->read(&file, 2000, msg) <= 0) + if (file.fs->read(&file, MESSAGE_FILE_MAX, msg) <= 0) goto done; else prom_printf("%s", msg); -- 2.39.2