diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile index 14fcf7a8490f..42f30273458e 100644 --- a/usr.sbin/makefs/Makefile +++ b/usr.sbin/makefs/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.30 2012/04/19 15:36:06 ttoth Exp $ +# $NetBSD: Makefile,v 1.31 2012/04/19 17:28:25 christos Exp $ # -WARNS?= 3 # XXX -Wsign-compare +WARNS?= 5 .include diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c index 6ee0e0bcd407..6503cababd44 100644 --- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c +++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_eltorito.c,v 1.18 2012/04/02 19:01:21 christos Exp $ */ +/* $NetBSD: cd9660_eltorito.c,v 1.19 2012/04/19 17:28:25 christos Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -39,7 +39,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: cd9660_eltorito.c,v 1.18 2012/04/02 19:01:21 christos Exp $"); +__RCSID("$NetBSD: cd9660_eltorito.c,v 1.19 2012/04/19 17:28:25 christos Exp $"); #endif /* !__lint */ #ifdef DEBUG @@ -244,7 +244,7 @@ cd9660_boot_setup_validation_entry(char sys) boot_catalog_validation_entry *ve; int16_t checksum; unsigned char *csptr; - int i; + size_t i; entry = cd9660_init_boot_catalog_entry(); if (entry == NULL) { diff --git a/usr.sbin/makefs/chfs.c b/usr.sbin/makefs/chfs.c index a53682656101..c7712e9c4d71 100644 --- a/usr.sbin/makefs/chfs.c +++ b/usr.sbin/makefs/chfs.c @@ -98,7 +98,6 @@ chfs_parse_opts(const char *option, fsinfo_t *fsopts) } *val++ = '\0'; -/*###101 [cc] error: passing argument 1 of 'set_option' discards qualifiers from pointer target type%%%*/ retval = set_option(chfs_options, var, val); leave_chfs_parse_opts: @@ -217,8 +216,8 @@ chfs_populate_dir(const char *dir, fsnode *root, fsnode *parent, if (cur->child == NULL) { continue; } - if (snprintf(path, sizeof(path), "%s/%s", dir, cur->name) - >= sizeof(path)) { + if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir, + cur->name) >= sizeof(path)) { errx(EXIT_FAILURE, "Pathname too long"); } if (!chfs_populate_dir(path, cur->child, cur, fsopts)) { diff --git a/usr.sbin/makefs/chfs/chfs_mkfs.c b/usr.sbin/makefs/chfs/chfs_mkfs.c index 78c824dfe8a7..77a4af452045 100644 --- a/usr.sbin/makefs/chfs/chfs_mkfs.c +++ b/usr.sbin/makefs/chfs/chfs_mkfs.c @@ -100,7 +100,8 @@ padword(fsinfo_t *fsopts) static void pad_block_if_less_than(fsinfo_t *fsopts, int req) { - if ((img_ofs % chfs_opts.eraseblock) + req > chfs_opts.eraseblock) { + if ((img_ofs % chfs_opts.eraseblock) + req > + (uint32_t)chfs_opts.eraseblock) { padblock(fsopts); write_eb_header(fsopts); } @@ -117,7 +118,7 @@ write_eb_header(fsinfo_t *fsopts) #define MINSIZE MAX(MAX(CHFS_EB_EC_HDR_SIZE, CHFS_EB_HDR_NOR_SIZE), \ CHFS_EB_HDR_NAND_SIZE) - if (opts->pagesize < MINSIZE) + if ((uint32_t)opts->pagesize < MINSIZE) errx(EXIT_FAILURE, "pagesize cannot be less than %zu", MINSIZE); if ((buf = malloc(opts->pagesize)) == NULL) err(EXIT_FAILURE, "Memory allocation failed"); diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 6816c62a8c23..4b3bcb467296 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.46 2012/01/28 02:35:46 christos Exp $ */ +/* $NetBSD: ffs.c,v 1.47 2012/04/19 17:28:25 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -71,7 +71,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs.c,v 1.46 2012/01/28 02:35:46 christos Exp $"); +__RCSID("$NetBSD: ffs.c,v 1.47 2012/04/19 17:28:25 christos Exp $"); #endif /* !__lint */ #include @@ -536,7 +536,7 @@ ffs_create_image(const char *image, fsinfo_t *fsopts) (long long)fs->fs_cstotal.cs_ndir); } - if (fs->fs_cstotal.cs_nifree + ROOTINO < fsopts->inodes) { + if ((off_t)(fs->fs_cstotal.cs_nifree + ROOTINO) < fsopts->inodes) { warnx( "Image file `%s' has %lld free inodes; %lld are required.", image, @@ -603,7 +603,7 @@ ffs_size_dir(fsnode *root, fsinfo_t *fsopts) if (node->type == S_IFREG) ADDSIZE(node->inode->st.st_size); if (node->type == S_IFLNK) { - int slen; + size_t slen; slen = strlen(node->symlink) + 1; if (slen >= (ffs_opts->version == 1 ? @@ -626,7 +626,7 @@ static void * ffs_build_dinode1(struct ufs1_dinode *dinp, dirbuf_t *dbufp, fsnode *cur, fsnode *root, fsinfo_t *fsopts) { - int slen; + size_t slen; void *membuf; memset(dinp, 0, sizeof(*dinp)); @@ -674,7 +674,7 @@ static void * ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t *dbufp, fsnode *cur, fsnode *root, fsinfo_t *fsopts) { - int slen; + size_t slen; void *membuf; memset(dinp, 0, sizeof(*dinp)); @@ -825,8 +825,8 @@ ffs_populate_dir(const char *dir, fsnode *root, fsinfo_t *fsopts) for (cur = root; cur != NULL; cur = cur->next) { if (cur->child == NULL) continue; - if (snprintf(path, sizeof(path), "%s/%s", dir, cur->name) - >= sizeof(path)) + if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir, + cur->name) >= sizeof(path)) errx(1, "Pathname too long."); if (! ffs_populate_dir(path, cur->child, fsopts)) return (0); @@ -1047,7 +1047,7 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts) int cg, cgino, i; daddr_t d; char sbbuf[FFS_MAXBSIZE]; - int32_t initediblk; + uint32_t initediblk; ffs_opt_t *ffs_opts = fsopts->fs_specific; assert (dp != NULL); @@ -1098,7 +1098,8 @@ ffs_write_inode(union dinode *dp, uint32_t ino, const fsinfo_t *fsopts) * Initialize inode blocks on the fly for UFS2. */ initediblk = ufs_rw32(cgp->cg_initediblk, fsopts->needswap); - if (ffs_opts->version == 2 && cgino + INOPB(fs) > initediblk && + if (ffs_opts->version == 2 && + (uint32_t)(cgino + INOPB(fs)) > initediblk && initediblk < ufs_rw32(cgp->cg_niblk, fsopts->needswap)) { memset(buf, 0, fs->fs_bsize); dip = (struct ufs2_dinode *)buf; diff --git a/usr.sbin/makefs/ffs/ffs_alloc.c b/usr.sbin/makefs/ffs/ffs_alloc.c index 54e7afc10363..b43e66f60397 100644 --- a/usr.sbin/makefs/ffs/ffs_alloc.c +++ b/usr.sbin/makefs/ffs/ffs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_alloc.c,v 1.18 2011/03/06 17:08:42 bouyer Exp $ */ +/* $NetBSD: ffs_alloc.c,v 1.19 2012/04/19 17:28:26 christos Exp $ */ /* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */ /* @@ -47,7 +47,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs_alloc.c,v 1.18 2011/03/06 17:08:42 bouyer Exp $"); +__RCSID("$NetBSD: ffs_alloc.c,v 1.19 2012/04/19 17:28:26 christos Exp $"); #endif /* !__lint */ #include @@ -106,7 +106,7 @@ ffs_alloc(struct inode *ip, daddr_t lbn __unused, daddr_t bpref, int size, int cg; *bnp = 0; - if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) { + if (size > fs->fs_bsize || fragoff(fs, size) != 0) { errx(1, "ffs_alloc: bad size: bsize %d size %d", fs->fs_bsize, size); } @@ -195,11 +195,7 @@ ffs_blkpref_ufs1(struct inode *ip, daddr_t lbn, int indx, int32_t *bap) } daddr_t -ffs_blkpref_ufs2(ip, lbn, indx, bap) - struct inode *ip; - daddr_t lbn; - int indx; - int64_t *bap; +ffs_blkpref_ufs2(struct inode *ip, daddr_t lbn, int indx, int64_t *bap) { struct fs *fs; int cg; @@ -444,7 +440,7 @@ ffs_blkfree(struct inode *ip, daddr_t bno, long size) struct fs *fs = ip->i_fs; const int needswap = UFS_FSNEEDSWAP(fs); - if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0 || + if (size > fs->fs_bsize || fragoff(fs, size) != 0 || fragnum(fs, bno) + numfrags(fs, size) > fs->fs_frag) { errx(1, "blkfree: bad size: bno %lld bsize %d size %ld", (long long)bno, fs->fs_bsize, size); diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index c889a4f58d27..cfedd706fc5c 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.22 2011/10/09 21:33:43 christos Exp $ */ +/* $NetBSD: mkfs.c,v 1.23 2012/04/19 17:28:26 christos Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.22 2011/10/09 21:33:43 christos Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.23 2012/04/19 17:28:26 christos Exp $"); #endif #endif #endif /* not lint */ @@ -599,7 +599,7 @@ static void initcg(int cylno, time_t utime, const fsinfo_t *fsopts) { daddr_t cbase, dmax; - int32_t i, j, d, dlower, dupper, blkno; + int i, j, d, dlower, dupper, blkno; struct ufs1_dinode *dp1; struct ufs2_dinode *dp2; int start; @@ -667,8 +667,8 @@ initcg(int cylno, time_t utime, const fsinfo_t *fsopts) } acg.cg_cs.cs_nifree += sblock.fs_ipg; if (cylno == 0) - for (i = 0; i < ROOTINO; i++) { - setbit(cg_inosused(&acg, 0), i); + for (size_t r = 0; r < ROOTINO; r++) { + setbit(cg_inosused(&acg, 0), r); acg.cg_cs.cs_nifree--; } if (cylno > 0) { diff --git a/usr.sbin/makefs/v7fs/v7fs_estimate.c b/usr.sbin/makefs/v7fs/v7fs_estimate.c index 4a457a97c0c3..74b7e25a66f2 100644 --- a/usr.sbin/makefs/v7fs/v7fs_estimate.c +++ b/usr.sbin/makefs/v7fs/v7fs_estimate.c @@ -1,4 +1,4 @@ -/* $NetBSD: v7fs_estimate.c,v 1.2 2011/08/10 11:31:49 uch Exp $ */ +/* $NetBSD: v7fs_estimate.c,v 1.3 2012/04/19 17:28:26 christos Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: v7fs_estimate.c,v 1.2 2011/08/10 11:31:49 uch Exp $"); +__RCSID("$NetBSD: v7fs_estimate.c,v 1.3 2012/04/19 17:28:26 christos Exp $"); #endif /* !__lint */ #include @@ -192,9 +192,8 @@ static void determine_fs_size(fsinfo_t *fsopts, struct v7fs_geometry *geom) { v7fs_daddr_t nblk = geom->ndatablock; - v7fs_daddr_t fsblk; + v7fs_daddr_t fsblk, n; int32_t nfiles = geom->ninode; - int n; VPRINTF("size=%lld inodes=%lld fd=%d superb=%p onlyspec=%d\n", (long long)fsopts->size, (long long)fsopts->inodes, fsopts->fd, diff --git a/usr.sbin/makefs/walk.c b/usr.sbin/makefs/walk.c index 6bb0d27b23f2..935d4fe1bef2 100644 --- a/usr.sbin/makefs/walk.c +++ b/usr.sbin/makefs/walk.c @@ -1,4 +1,4 @@ -/* $NetBSD: walk.c,v 1.25 2012/01/28 02:35:46 christos Exp $ */ +/* $NetBSD: walk.c,v 1.26 2012/04/19 17:28:25 christos Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -41,7 +41,7 @@ #include #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: walk.c,v 1.25 2012/01/28 02:35:46 christos Exp $"); +__RCSID("$NetBSD: walk.c,v 1.26 2012/04/19 17:28:25 christos Exp $"); #endif /* !__lint */ #include @@ -387,7 +387,7 @@ apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly) if (strcmp(curnode->name, curfsnode->name) == 0) break; } - if (snprintf(path, sizeof(path), "%s/%s", + if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir, curnode->name) >= sizeof(path)) errx(1, "Pathname too long."); if (curfsnode == NULL) { /* need new entry */