From d4346bb0a21a0fc4e1077a6bb4ca71a850351c3a Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Sun, 13 Feb 2005 19:22:42 +0000 Subject: [PATCH] Raise WARNS to 6: - Double-cast values when testing their ranges for validity. --- sbin/badsect/Makefile | 3 ++- sbin/badsect/badsect.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sbin/badsect/Makefile b/sbin/badsect/Makefile index a1e4a67fb0..22b661b763 100644 --- a/sbin/badsect/Makefile +++ b/sbin/badsect/Makefile @@ -1,8 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/5/93 # $FreeBSD: src/sbin/badsect/Makefile,v 1.2.14.1 2001/04/25 10:58:12 ru Exp $ -# $DragonFly: src/sbin/badsect/Makefile,v 1.2 2003/06/17 04:27:32 dillon Exp $ +# $DragonFly: src/sbin/badsect/Makefile,v 1.3 2005/02/13 19:22:42 cpressey Exp $ PROG= badsect +WARNS?= 6 MAN= badsect.8 .include diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c index b5ecf9dbf4..89b457787c 100644 --- a/sbin/badsect/badsect.c +++ b/sbin/badsect/badsect.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1981, 1983, 1993 The Regents of the University of California. All rights reserved. * @(#)badsect.c 8.1 (Berkeley) 6/5/93 * $FreeBSD: src/sbin/badsect/badsect.c,v 1.7.2.2 2001/07/30 10:30:04 dd Exp $ - * $DragonFly: src/sbin/badsect/badsect.c,v 1.6 2005/01/14 07:03:59 joerg Exp $ + * $DragonFly: src/sbin/badsect/badsect.c,v 1.7 2005/02/13 19:22:42 cpressey Exp $ */ /* @@ -142,7 +142,7 @@ main(int argc, char **argv) * bit was lost by bogus sign extensions. */ diskbn = dbtofsb(fs, number); - if ((dev_t)diskbn != diskbn) { + if ((daddr_t)((dev_t)diskbn) != diskbn) { printf("sector %ld cannot be represented as a dev_t\n", (long)number); errs++; @@ -163,7 +163,7 @@ chkuse(daddr_t blkno, int cnt) daddr_t fsbn, bn; fsbn = dbtofsb(fs, blkno); - if ((unsigned)(fsbn+cnt) > fs->fs_size) { + if ((int32_t)((unsigned)(fsbn+cnt)) > fs->fs_size) { printf("block %ld out of range of file system\n", (long)blkno); return (1); } -- 2.41.0