Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/ia64/stand/efi/libefi Uninitialized var, found by b...



details:   https://anonhg.NetBSD.org/src/rev/020f73abd13f
branches:  trunk
changeset: 347125:020f73abd13f
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Aug 15 09:00:52 2016 +0000

description:
Uninitialized var, found by brainy. I haven't tested this change, and it
may not be the perfect way to fix it. But it seems correct enough.

diffstat:

 sys/arch/ia64/stand/efi/libefi/devicename.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r dd9d99a2c606 -r 020f73abd13f sys/arch/ia64/stand/efi/libefi/devicename.c
--- a/sys/arch/ia64/stand/efi/libefi/devicename.c       Mon Aug 15 08:52:33 2016 +0000
+++ b/sys/arch/ia64/stand/efi/libefi/devicename.c       Mon Aug 15 09:00:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devicename.c,v 1.8 2014/04/08 21:51:06 martin Exp $    */
+/*     $NetBSD: devicename.c,v 1.9 2016/08/15 09:00:52 maxv Exp $      */
 
 /*-
  * Copyright (c) 1998 Michael Smith <msmith%freebsd.org@localhost>
@@ -95,7 +95,7 @@
        struct devsw    *dv;
        int dv_type;
        int             i, unit, slice, partition, err;
-       char            *cp;
+       char            *cp = NULL;
        const char      *np;
 
        /* minimum length check */
@@ -151,6 +151,10 @@
                                cp++;
                        }
                }
+               if (cp == NULL) {
+                       err = EINVAL;
+                       goto fail;
+               }
                if (*cp && (*cp != ':')) {
                        err = EINVAL;
                        goto fail;
@@ -174,6 +178,10 @@
                                goto fail;
                        }
                }
+               if (cp == NULL) {
+                       err = EINVAL;
+                       goto fail;
+               }
                if (*cp && (*cp != ':')) {
                        err = EINVAL;
                        goto fail;



Home | Main Index | Thread Index | Old Index