[coreboot-gerrit] Change in coreboot[master]: soc/amd/common/block/pi/amd_late_init.c: Fix coverity issue CID 1387031

Richard Spiegel (Code Review) gerrit at coreboot.org
Wed Mar 28 22:44:04 CEST 2018


Richard Spiegel has uploaded this change for review. ( https://review.coreboot.org/25419


Change subject: soc/amd/common/block/pi/amd_late_init.c: Fix coverity issue CID 1387031
......................................................................

soc/amd/common/block/pi/amd_late_init.c: Fix coverity issue CID 1387031

CID 1387031: Memory - illegal accesses (BUFFER_SIZE_WARNING). Calling
strncpy with a maximum size argument of 19 bytes on destination array
"dimm->module_part_number" of size 19 bytes might leave the destination
string unterminated. Fix the size parameter.

BUG=b:76202696
TEST=Build and boot kahlee, using special debug code to see the output
strings, which was later removed.

Change-Id: I18fa5e9c73401575441b6810f1db80d11666368c
Signed-off-by: Richard Spiegel <richard.spiegel at silverbackltd.com>
---
M src/soc/amd/common/block/pi/amd_late_init.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/19/25419/1

diff --git a/src/soc/amd/common/block/pi/amd_late_init.c b/src/soc/amd/common/block/pi/amd_late_init.c
index 48c1718..7c3d759 100644
--- a/src/soc/amd/common/block/pi/amd_late_init.c
+++ b/src/soc/amd/common/block/pi/amd_late_init.c
@@ -50,7 +50,7 @@
 	dimm->mod_id = dmi17->ManufacturerIdCode;
 	dimm->bank_locator = 0;
 	strncpy((char *)dimm->module_part_number, dmi17->PartNumber,
-				sizeof(dimm->module_part_number));
+				sizeof(dimm->module_part_number) - 1);
 }
 
 static void print_dimm_info(const struct dimm_info *dimm)

-- 
To view, visit https://review.coreboot.org/25419
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I18fa5e9c73401575441b6810f1db80d11666368c
Gerrit-Change-Number: 25419
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Spiegel <richard.spiegel at silverbackltd.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180328/e9f60ee7/attachment.html>


More information about the coreboot-gerrit mailing list