From: Anton Blanchard Date: Sat, 10 Apr 2010 18:04:27 +0000 (+0000) Subject: Remove magic numbers in print_message_file X-Git-Tag: yaboot-1.3.17-rc1~22 X-Git-Url: http://git.ozlabs.org/?p=yaboot.git;a=commitdiff_plain;h=6d1b9adfa92da6ad903544b7497f05462ef8a301;hp=81d00c88d7a046b86d0f4298686e7627dc8d135e 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 --- 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);