Philip Prindeville (pprindeville@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/504
-gerrit
commit 0ab8e97acc036c78c7c9e49995be94d275f91ef6 Author: Philip Prindeville philipp@redfish-solutions.com Date: Fri Dec 23 18:45:33 2011 -0700
Eliminate magic numbers
Use sizeof() on vendor and part# rather than explicit memory length.
Change-Id: I2b7e0e4a8df6448d027cc61867382f161eb990d3 Signed-off-by: Philip Prindeville philipp@redfish-solutions.com --- payloads/coreinfo/coreboot_module.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/payloads/coreinfo/coreboot_module.c b/payloads/coreinfo/coreboot_module.c index d33ea9e..77a4bb2 100644 --- a/payloads/coreinfo/coreboot_module.c +++ b/payloads/coreinfo/coreboot_module.c @@ -142,8 +142,8 @@ static void parse_mainboard(unsigned char *ptr) { struct cb_mainboard *mb = (struct cb_mainboard *)ptr;
- strncpy(cb_info.vendor, cb_mb_vendor_part(mb), 31); - strncpy(cb_info.part, cb_mb_part_string(mb), 31); + strncpy(cb_info.vendor, cb_mb_vendor_part(mb), sizeof(cb_info.vendor) - 1); + strncpy(cb_info.part, cb_mb_part_string(mb), sizeof(cb_info.part) - 1); }
static void parse_strings(unsigned char *ptr)