Module Name:    src
Committed By:   jnemeth
Date:           Tue Aug 19 18:20:51 UTC 2014

Modified Files:
        src/sys/arch/sparc64/dev: fdc.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc64/dev/fdc.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/sparc64/dev/fdc.c
diff -u src/sys/arch/sparc64/dev/fdc.c:1.41 src/sys/arch/sparc64/dev/fdc.c:1.42
--- src/sys/arch/sparc64/dev/fdc.c:1.41	Fri Jul 25 08:10:35 2014
+++ src/sys/arch/sparc64/dev/fdc.c	Tue Aug 19 18:20:51 2014
@@ -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 @@ fdgetdisklabel(dev_t dev)
 	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);

Reply via email to