Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/specfs messing with uninitialized structs is a ba...



details:   https://anonhg.NetBSD.org/src/rev/ceebc81fd262
branches:  trunk
changeset: 342082:ceebc81fd262
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Sat Dec 05 07:59:34 2015 +0000

description:
messing with uninitialized structs is a bad thing

diffstat:

 sys/miscfs/specfs/spec_vnops.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 0b3bf3892adc -r ceebc81fd262 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c    Sat Dec 05 06:54:22 2015 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c    Sat Dec 05 07:59:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_vnops.c,v 1.154 2015/12/04 23:54:06 christos Exp $        */
+/*     $NetBSD: spec_vnops.c,v 1.155 2015/12/05 07:59:34 jnemeth Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.154 2015/12/04 23:54:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.155 2015/12/05 07:59:34 jnemeth Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -668,7 +668,8 @@
                printf("ioctl DIOCGMEDIASIZE failed %d\n", error);
 #endif
                error = (*ioctl)(vp->v_rdev, DIOCGPART, &pi, FREAD, curlwp);
-               off = (off_t)pi.disklab->d_secsize * pi.part->p_size;
+               if (error == 0)
+                       off = (off_t)pi.disklab->d_secsize * pi.part->p_size;
        }
 
        if (error == 0)



Home | Main Index | Thread Index | Old Index