Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Don't cast the return value of malloc.



details:   https://anonhg.NetBSD.org/src/rev/0c8da385500f
branches:  trunk
changeset: 809496:0c8da385500f
user:      dholland <dholland%NetBSD.org@localhost>
date:      Thu Jul 16 08:31:45 2015 +0000

description:
Don't cast the return value of malloc.

diffstat:

 sys/ufs/lfs/lfs_alloc.c  |   6 +++---
 sys/ufs/lfs/lfs_inode.c  |   6 +++---
 sys/ufs/lfs/lfs_rfw.c    |   8 ++++----
 sys/ufs/lfs/lfs_subr.c   |   8 ++++----
 sys/ufs/lfs/lfs_vfsops.c |  16 ++++++++--------
 5 files changed, 22 insertions(+), 22 deletions(-)

diffs (149 lines):

diff -r d650e15550ce -r 0c8da385500f sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Thu Jul 16 00:03:59 2015 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Thu Jul 16 08:31:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.120 2015/05/31 15:48:03 hannken Exp $  */
+/*     $NetBSD: lfs_alloc.c,v 1.121 2015/07/16 08:31:45 dholland Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.120 2015/05/31 15:48:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_alloc.c,v 1.121 2015/07/16 08:31:45 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -555,7 +555,7 @@
 
        maxino = ((fs->lfs_ivnode->v_size >> fs->lfs_bshift) -
                  fs->lfs_cleansz - fs->lfs_segtabsz) * fs->lfs_ifpb;
-       fs->lfs_ino_bitmap = (lfs_bm_t *)
+       fs->lfs_ino_bitmap =
                malloc(((maxino + BMMASK) >> BMSHIFT) * sizeof(lfs_bm_t),
                       M_SEGMENT, M_WAITOK | M_ZERO);
        KASSERT(fs->lfs_ino_bitmap != NULL);
diff -r d650e15550ce -r 0c8da385500f sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Thu Jul 16 00:03:59 2015 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Thu Jul 16 08:31:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.136 2013/10/17 21:01:08 christos Exp $ */
+/*     $NetBSD: lfs_inode.c,v 1.137 2015/07/16 08:31:45 dholland Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.136 2013/10/17 21:01:08 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_inode.c,v 1.137 2015/07/16 08:31:45 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -755,7 +755,7 @@
 
        bap = (int32_t *)bp->b_data;    /* XXX ondisk32 */
        if (lastbn >= 0) {
-               copy = (int32_t *)lfs_malloc(fs, fs->lfs_bsize, LFS_NB_IBLOCK);
+               copy = lfs_malloc(fs, fs->lfs_bsize, LFS_NB_IBLOCK);
                memcpy((void *)copy, (void *)bap, (u_int)fs->lfs_bsize);
                memset((void *)&bap[last + 1], 0,
                /* XXX ondisk32 */
diff -r d650e15550ce -r 0c8da385500f sys/ufs/lfs/lfs_rfw.c
--- a/sys/ufs/lfs/lfs_rfw.c     Thu Jul 16 00:03:59 2015 +0000
+++ b/sys/ufs/lfs/lfs_rfw.c     Thu Jul 16 08:31:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_rfw.c,v 1.20 2015/05/31 15:48:03 hannken Exp $     */
+/*     $NetBSD: lfs_rfw.c,v 1.21 2015/07/16 08:31:45 dholland Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.20 2015/05/31 15:48:03 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_rfw.c,v 1.21 2015/07/16 08:31:45 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_quota.h"
@@ -429,8 +429,8 @@
                }
                nblocks += ninos;
                /* Create the sum array */
-               datap = dp = (u_long *)malloc(nblocks * sizeof(u_long),
-                                             M_SEGMENT, M_WAITOK);
+               datap = dp = malloc(nblocks * sizeof(u_long),
+                                   M_SEGMENT, M_WAITOK);
        }
 
        /* Handle individual blocks */
diff -r d650e15550ce -r 0c8da385500f sys/ufs/lfs/lfs_subr.c
--- a/sys/ufs/lfs/lfs_subr.c    Thu Jul 16 00:03:59 2015 +0000
+++ b/sys/ufs/lfs/lfs_subr.c    Thu Jul 16 08:31:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_subr.c,v 1.80 2013/07/28 01:05:52 dholland Exp $   */
+/*     $NetBSD: lfs_subr.c,v 1.81 2015/07/16 08:31:45 dholland Exp $   */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.80 2013/07/28 01:05:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.81 2015/07/16 08:31:45 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -106,8 +106,8 @@
        int maxbpp;
 
        ASSERT_NO_SEGLOCK(fs);
-       fs->lfs_resblk = (res_t *)malloc(LFS_N_TOTAL * sizeof(res_t), M_SEGMENT,
-                                         M_WAITOK);
+       fs->lfs_resblk = malloc(LFS_N_TOTAL * sizeof(res_t), M_SEGMENT,
+                               M_WAITOK);
        for (i = 0; i < LFS_N_TOTAL; i++) {
                fs->lfs_resblk[i].inuse = 0;
                fs->lfs_resblk[i].p = NULL;
diff -r d650e15550ce -r 0c8da385500f sys/ufs/lfs/lfs_vfsops.c
--- a/sys/ufs/lfs/lfs_vfsops.c  Thu Jul 16 00:03:59 2015 +0000
+++ b/sys/ufs/lfs/lfs_vfsops.c  Thu Jul 16 08:31:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vfsops.c,v 1.325 2015/06/07 13:39:48 hannken Exp $ */
+/*     $NetBSD: lfs_vfsops.c,v 1.326 2015/07/16 08:31:45 dholland Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.325 2015/06/07 13:39:48 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.326 2015/07/16 08:31:45 dholland Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -1091,12 +1091,12 @@
 
        /* Set up segment usage flags for the autocleaner. */
        fs->lfs_nactive = 0;
-       fs->lfs_suflags = (u_int32_t **)malloc(2 * sizeof(u_int32_t *),
-                                               M_SEGMENT, M_WAITOK);
-       fs->lfs_suflags[0] = (u_int32_t *)malloc(fs->lfs_nseg * sizeof(u_int32_t),
-                                                M_SEGMENT, M_WAITOK);
-       fs->lfs_suflags[1] = (u_int32_t *)malloc(fs->lfs_nseg * sizeof(u_int32_t),
-                                                M_SEGMENT, M_WAITOK);
+       fs->lfs_suflags = malloc(2 * sizeof(u_int32_t *),
+                                M_SEGMENT, M_WAITOK);
+       fs->lfs_suflags[0] = malloc(fs->lfs_nseg * sizeof(u_int32_t),
+                                   M_SEGMENT, M_WAITOK);
+       fs->lfs_suflags[1] = malloc(fs->lfs_nseg * sizeof(u_int32_t),
+                                   M_SEGMENT, M_WAITOK);
        memset(fs->lfs_suflags[1], 0, fs->lfs_nseg * sizeof(u_int32_t));
        for (i = 0; i < fs->lfs_nseg; i++) {
                int changed;



Home | Main Index | Thread Index | Old Index