Module Name: src
Committed By: mlelstv
Date: Mon Dec 29 14:00:26 UTC 2014
Modified Files:
src/sys/arch/x86/x86: ipmi.c
Log Message:
Avoid NULL pointer dereference if SMBIOS key "system-product" does not
exist.
To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/x86/ipmi.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/ipmi.c
diff -u src/sys/arch/x86/x86/ipmi.c:1.59 src/sys/arch/x86/x86/ipmi.c:1.60
--- src/sys/arch/x86/x86/ipmi.c:1.59 Mon Sep 22 13:30:55 2014
+++ src/sys/arch/x86/x86/ipmi.c Mon Dec 29 14:00:26 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ipmi.c,v 1.59 2014/09/22 13:30:55 nat Exp $ */
+/* $NetBSD: ipmi.c,v 1.60 2014/12/29 14:00:26 mlelstv Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.59 2014/09/22 13:30:55 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.60 2014/12/29 14:00:26 mlelstv Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -891,6 +891,7 @@ dumpb(const char *lbl, int len, const ui
void
ipmi_smbios_probe(struct smbios_ipmi *pipmi, struct ipmi_attach_args *ia)
{
+ const char *platform;
dbg_printf(1, "ipmi_smbios_probe: %02x %02x %02x %02x "
"%08" PRIx64 " %02x %02x\n",
@@ -938,8 +939,9 @@ ipmi_smbios_probe(struct smbios_ipmi *pi
if (pipmi->smipmi_base_flags & SMIPMI_FLAG_ODDOFFSET)
ia->iaa_if_iobase++;
- if (strcmp(pmf_get_platform("system-product"),
- "ProLiant MicroServer") == 0) {
+ platform = pmf_get_platform("system-product");
+ if (platform != NULL &&
+ strcmp(platform, "ProLiant MicroServer") == 0) {
ia->iaa_if_iospacing = 1;
ia->iaa_if_iobase = pipmi->smipmi_base_address - 7;
ia->iaa_if_iotype = 'i';