Don't cast the return value of malloc.

This commit is contained in:
dholland 2015-07-16 08:31:45 +00:00
parent f1354ae7ef
commit 61051b208c
5 changed files with 22 additions and 22 deletions

View File

@ -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 @@ lfs_order_freelist(struct lfs *fs)
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);

View File

@ -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 @@ lfs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn,
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 */

View File

@ -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 @@ check_segsum(struct lfs *fs, daddr_t offset, u_int64_t nextserial,
}
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 */

View File

@ -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 @@ lfs_setup_resblks(struct lfs *fs)
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;

View File

@ -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 @@ lfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
/* 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;