Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi Replace memset with incorrect size argument w...



details:   https://anonhg.NetBSD.org/src/rev/29ece81e4152
branches:  trunk
changeset: 771568:29ece81e4152
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Nov 25 12:39:55 2011 +0000

description:
Replace memset with incorrect size argument with M_ZERO.

diffstat:

 sys/dev/scsipi/cd.c |  8 ++++----
 sys/dev/scsipi/sd.c |  8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (62 lines):

diff -r 083f0d641984 -r 29ece81e4152 sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Fri Nov 25 12:31:55 2011 +0000
+++ b/sys/dev/scsipi/cd.c       Fri Nov 25 12:39:55 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.303 2011/05/20 09:23:37 reinoud Exp $ */
+/*     $NetBSD: cd.c,v 1.304 2011/11/25 12:39:55 joerg Exp $   */
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.303 2011/05/20 09:23:37 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.304 2011/11/25 12:39:55 joerg Exp $");
 
 #include "rnd.h"
 
@@ -1354,10 +1354,10 @@
 
 #ifdef __HAVE_OLD_DISKLABEL
                if (cmd == ODIOCSDINFO || cmd == ODIOCWDINFO) {
-                       newlabel = malloc(sizeof (*newlabel), M_TEMP, M_WAITOK);
+                       newlabel = malloc(sizeof (*newlabel), M_TEMP,
+                           M_WAITOK | M_ZERO);
                        if (newlabel == NULL)
                                return (EIO);
-                       memset(newlabel, 0, sizeof newlabel);
                        memcpy(newlabel, addr, sizeof (struct olddisklabel));
                        lp = newlabel;
                } else
diff -r 083f0d641984 -r 29ece81e4152 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c       Fri Nov 25 12:31:55 2011 +0000
+++ b/sys/dev/scsipi/sd.c       Fri Nov 25 12:39:55 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.294 2011/07/30 12:08:37 jmcneill Exp $        */
+/*     $NetBSD: sd.c,v 1.295 2011/11/25 12:39:56 joerg Exp $   */
 
 /*-
  * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.294 2011/07/30 12:08:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.295 2011/11/25 12:39:56 joerg Exp $");
 
 #include "opt_scsi.h"
 #include "rnd.h"
@@ -1074,10 +1074,10 @@
 
 #ifdef __HAVE_OLD_DISKLABEL
                if (cmd == ODIOCSDINFO || cmd == ODIOCWDINFO) {
-                       newlabel = malloc(sizeof *newlabel, M_TEMP, M_WAITOK);
+                       newlabel = malloc(sizeof *newlabel, M_TEMP,
+                           M_WAITOK | M_ZERO);
                        if (newlabel == NULL)
                                return EIO;
-                       memset(newlabel, 0, sizeof newlabel);
                        memcpy(newlabel, addr, sizeof (struct olddisklabel));
                        lp = newlabel;
                } else



Home | Main Index | Thread Index | Old Index