Module Name:    src
Committed By:   maxv
Date:           Mon Aug 15 09:00:52 UTC 2016

Modified Files:
        src/sys/arch/ia64/stand/efi/libefi: devicename.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/stand/efi/libefi/devicename.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/ia64/stand/efi/libefi/devicename.c
diff -u src/sys/arch/ia64/stand/efi/libefi/devicename.c:1.8 src/sys/arch/ia64/stand/efi/libefi/devicename.c:1.9
--- src/sys/arch/ia64/stand/efi/libefi/devicename.c:1.8	Tue Apr  8 21:51:06 2014
+++ src/sys/arch/ia64/stand/efi/libefi/devicename.c	Mon Aug 15 09:00:52 2016
@@ -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 <msm...@freebsd.org>
@@ -95,7 +95,7 @@ efi_parsedev(struct efi_devdesc **dev, c
 	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 @@ efi_parsedev(struct efi_devdesc **dev, c
 				cp++;
 			}
 		}
+		if (cp == NULL) {
+			err = EINVAL;
+			goto fail;
+		}
 		if (*cp && (*cp != ':')) {
 			err = EINVAL;
 			goto fail;
@@ -174,6 +178,10 @@ efi_parsedev(struct efi_devdesc **dev, c
 				goto fail;
 			}
 		}
+		if (cp == NULL) {
+			err = EINVAL;
+			goto fail;
+		}
 		if (*cp && (*cp != ':')) {
 			err = EINVAL;
 			goto fail;

Reply via email to