Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 2002 04:14:19 +0300
From:      Giorgos Keramidas <keramida@FreeBSD.org>
To:        audit@FreeBSD.org
Subject:   badsect warns
Message-ID:  <20020609011418.GA70449@hades.hell.gr>

next in thread | raw e-mail | index | archive | help
The following enables compiling badsect with WARNS=6.
There seems to be something funny about fs->fs_size though.
In <ufs/ffs/fs.h> it's not daddr_t but `long'.
This is why it triggers the warning now that the cast to
`unsigned' (which is there since revision 1.1 of badsect.c)
doesn't match the signed type of fs->fs_size.

Is there some reason that this is cast to `unsigned'?

If not, should we remove the cast and start building badsect with
something more strict than WARNS=0?

- Giorgos

%%%
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/sbin/badsect/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile	4 Dec 2001 02:19:44 -0000	1.5
+++ Makefile	8 Jun 2002 23:55:54 -0000
@@ -2,7 +2,7 @@
 # $FreeBSD: src/sbin/badsect/Makefile,v 1.5 2001/12/04 02:19:44 obrien Exp $
 
 PROG=	badsect
-WARNS=	0
+WARNS=	6
 MAN=	badsect.8
 
 .include <bsd.prog.mk>
Index: badsect.c
===================================================================
RCS file: /home/ncvs/src/sbin/badsect/badsect.c,v
retrieving revision 1.13
diff -u -r1.13 badsect.c
--- badsect.c	16 May 2002 04:09:51 -0000	1.13
+++ badsect.c	9 Jun 2002 01:00:54 -0000
@@ -168,7 +168,7 @@
 	daddr_t fsbn, bn;
 
 	fsbn = dbtofsb(fs, blkno);
-	if ((unsigned)(fsbn+cnt) > fs->fs_size) {
+	if ((fsbn + cnt) > fs->fs_size) {
 		printf("block %ld out of range of filesystem\n", (long)blkno);
 		return (1);
 	}
%%%

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020609011418.GA70449>