diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2011-05-26 01:35:19 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2011-05-26 01:35:19 +0000 |
commit | 7bcacb1bdb72f60f37a67883f871bbef9ec8c943 (patch) | |
tree | 8b540af2f9c993133ddb6cd3a513289dfbe7f549 /flashrom.c | |
parent | c0aaf954874841c839c7131505759b9403ec7e4b (diff) | |
download | flashrom-7bcacb1bdb72f60f37a67883f871bbef9ec8c943.tar.gz flashrom-7bcacb1bdb72f60f37a67883f871bbef9ec8c943.tar.bz2 flashrom-7bcacb1bdb72f60f37a67883f871bbef9ec8c943.zip |
Eliminate magic numbers indicating maximum column sizes in print.c
Without this the magic numbers need to be kept in sync with the maximum
length of the strings printed in the corresponding column. if not, an
overflow and a nasty ' '-storm occur on executing flashrom -L.
Corresponding to flashrom svn r1318.
Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Diffstat (limited to 'flashrom.c')
-rw-r--r-- | flashrom.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/flashrom.c b/flashrom.c index 46c9ecd3c..14d526382 100644 --- a/flashrom.c +++ b/flashrom.c @@ -1709,9 +1709,37 @@ int selfcheck(void) msg_gerr("Programmer table miscompilation!\n"); ret = 1; } + /* It would be favorable if we could also check for correct terminaion + * of the follwing arrays, but we don't know their size in here... + * For 'flashchips' we check the first element to be non-null. In the + * other cases there exist use cases where the first element can be + * null. */ + if (flashchips == NULL || flashchips[0].vendor == NULL) { + msg_gerr("Flashchips table miscompilation!\n"); + ret = 1; + } for (flash = flashchips; flash && flash->name; flash++) if (selfcheck_eraseblocks(flash)) ret = 1; + +#if CONFIG_INTERNAL == 1 + if (chipset_enables == NULL) { + msg_gerr("Chipset enables table does not exist!\n"); + ret = 1; + } + if (board_pciid_enables == NULL) { + msg_gerr("Board enables table does not exist!\n"); + ret = 1; + } + if (boards_known == NULL) { + msg_gerr("Known boards table does not exist!\n"); + ret = 1; + } + if (laptops_known == NULL) { + msg_gerr("Known laptops table does not exist!\n"); + ret = 1; + } +#endif // CONFIG_INTERNAL == 1 return ret; } |