Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev Fix panic() on opening fd(4), caused by a...



details:   https://anonhg.NetBSD.org/src/rev/82e1c338f555
branches:  trunk
changeset: 331690:82e1c338f555
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Tue Aug 19 14:43:41 2014 +0000

description:
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().

I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).

Should be pulled up to netbsd-7.

diffstat:

 sys/arch/sparc/dev/fd.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ba03d737db1b -r 82e1c338f555 sys/arch/sparc/dev/fd.c
--- a/sys/arch/sparc/dev/fd.c   Tue Aug 19 14:43:28 2014 +0000
+++ b/sys/arch/sparc/dev/fd.c   Tue Aug 19 14:43:41 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.154 2014/07/25 08:10:34 dholland Exp $        */
+/*     $NetBSD: fd.c,v 1.155 2014/08/19 14:43:41 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.154 2014/07/25 08:10:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.155 2014/08/19 14:43:41 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -2244,7 +2244,7 @@
        struct cpu_disklabel *clp = fd->sc_dk.dk_cpulabel;
 
        memset(lp, 0, sizeof(struct disklabel));
-       memset(lp, 0, sizeof(struct cpu_disklabel));
+       memset(clp, 0, sizeof(struct cpu_disklabel));
 
        lp->d_type = DTYPE_FLOPPY;
        lp->d_secsize = FD_BSIZE(fd);



Home | Main Index | Thread Index | Old Index