Module Name: src Committed By: maxv Date: Mon Aug 15 09:06:40 UTC 2016
Modified Files: src/sys/arch/ia64/stand/ia64/ski: devicename.c Log Message: Two uninitialized vars, found by brainy. The former is similar to the one I fixed in ia64/stand/efi/libefi/devicename.c. I don't know how to fix the latter, so just add a comment. I will probably file a PR for this one. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/ia64/stand/ia64/ski/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/ia64/ski/devicename.c diff -u src/sys/arch/ia64/stand/ia64/ski/devicename.c:1.7 src/sys/arch/ia64/stand/ia64/ski/devicename.c:1.8 --- src/sys/arch/ia64/stand/ia64/ski/devicename.c:1.7 Tue Apr 8 21:51:06 2014 +++ src/sys/arch/ia64/stand/ia64/ski/devicename.c Mon Aug 15 09:06:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: devicename.c,v 1.7 2014/04/08 21:51:06 martin Exp $ */ +/* $NetBSD: devicename.c,v 1.8 2016/08/15 09:06:39 maxv Exp $ */ /*- * Copyright (c) 1998 Michael Smith <msm...@freebsd.org> @@ -91,7 +91,7 @@ ski_parsedev(struct ski_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 */ @@ -146,6 +146,10 @@ ski_parsedev(struct ski_devdesc **dev, c cp++; } } + if (cp == NULL) { + err = EINVAL; + goto fail; + } if (*cp && (*cp != ':')) { err = EINVAL; goto fail; @@ -169,6 +173,10 @@ ski_parsedev(struct ski_devdesc **dev, c goto fail; } } + if (cp == NULL) { + err = EINVAL; + goto fail; + } if (*cp && (*cp != ':')) { err = EINVAL; goto fail; @@ -228,6 +236,7 @@ ski_fmtdev(void *vdev) break; case DEVT_NET: + /* XXX XXX XXX: Yay, 'len' is not initialized here */ snprintf(buf, buflen - len, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit); break; }