Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Avoid NULL pointer dereference if SMBIOS ke...



details:   https://anonhg.NetBSD.org/src/rev/f72640e41523
branches:  trunk
changeset: 335179:f72640e41523
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Dec 29 14:00:26 2014 +0000

description:
Avoid NULL pointer dereference if SMBIOS key "system-product" does not
exist.

diffstat:

 sys/arch/x86/x86/ipmi.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 3e50cdf48189 -r f72640e41523 sys/arch/x86/x86/ipmi.c
--- a/sys/arch/x86/x86/ipmi.c   Mon Dec 29 13:38:13 2014 +0000
+++ b/sys/arch/x86/x86/ipmi.c   Mon Dec 29 14:00:26 2014 +0000
@@ -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 @@
 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 @@
        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';



Home | Main Index | Thread Index | Old Index