[coreboot-gerrit] Change in coreboot[master]: arch/x86/smbios: Consider conner case of Part Number
Lijian Zhao (Code Review)
gerrit at coreboot.org
Tue Mar 27 03:36:14 CEST 2018
Lijian Zhao has uploaded this change for review. ( https://review.coreboot.org/25377
Change subject: arch/x86/smbios: Consider conner case of Part Number
......................................................................
arch/x86/smbios: Consider conner case of Part Number
In case of all DMI Type 17 could be all empty, the strip trailing
whitespace code will have a zero length Part Number entry, which will
cause exception when using (len - 1) where len is zero. Add extra code
to cover this corner case.
BUG=None
TEST=Boot up fine with moowth platform, without this patch system will
stuck at "Create SMBIOS type 17".
Change-Id: Id870c983584771dc1b60b1c99e95bbe7c0d25c4c
Signed-off-by: Lijian Zhao <lijian.zhao at intel.com>
---
M src/arch/x86/smbios.c
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/25377/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c
index 7079374..c14c231 100644
--- a/src/arch/x86/smbios.c
+++ b/src/arch/x86/smbios.c
@@ -232,10 +232,14 @@
len = strlen(trimmed_part_number);
invalid = 0; /* assume valid */
- for (i = 0; i < len - 1; i++) {
- if (trimmed_part_number[i] < ' ') {
- invalid = 1;
- trimmed_part_number[i] = '*';
+ if (len == 0)
+ invalid = 1;
+ else {
+ for (i = 0; i < len - 1; i++) {
+ if (trimmed_part_number[i] < ' ') {
+ invalid = 1;
+ trimmed_part_number[i] = '*';
+ }
}
}
--
To view, visit https://review.coreboot.org/25377
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: Id870c983584771dc1b60b1c99e95bbe7c0d25c4c
Gerrit-Change-Number: 25377
Gerrit-PatchSet: 1
Gerrit-Owner: Lijian Zhao <lijian.zhao at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180327/3f6e8791/attachment.html>
More information about the coreboot-gerrit
mailing list