Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/dev Sync with sparc/dev/fd.c:1.155.



details:   https://anonhg.NetBSD.org/src/rev/b4a23c86fe66
branches:  trunk
changeset: 331694:b4a23c86fe66
user:      jnemeth <jnemeth%NetBSD.org@localhost>
date:      Tue Aug 19 18:20:51 2014 +0000

description:
Sync with sparc/dev/fd.c:1.155.

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/sparc64/dev/fdc.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ad8c3acd7780 -r b4a23c86fe66 sys/arch/sparc64/dev/fdc.c
--- a/sys/arch/sparc64/dev/fdc.c        Tue Aug 19 16:18:15 2014 +0000
+++ b/sys/arch/sparc64/dev/fdc.c        Tue Aug 19 18:20:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdc.c,v 1.41 2014/07/25 08:10:35 dholland Exp $        */
+/*     $NetBSD: fdc.c,v 1.42 2014/08/19 18:20:51 jnemeth Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.41 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.42 2014/08/19 18:20:51 jnemeth Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -2430,7 +2430,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