Subject: misc/20092: More daddr_t-related format string problems
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jldavis@cs.oberlin.edu>
List: netbsd-bugs
Date: 01/28/2003 02:43:35
>Number:         20092
>Category:       misc
>Synopsis:       More daddr_t-related format string problems
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 27 23:44:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jed Davis
>Release:        -CURRENT as of 2003-01-28, 02:30ish US/Eastern
>Organization:
Oberlin College Computer Science
>Environment:
System: NetBSD rubisco 1.6M NetBSD 1.6M (RUBISCO) #2: Sun Jan 26 23:48:41 EST 2003 jdev@rubisco:/src/syssrc/compile/RUBISCO sparc64
Architecture: sparc64
Machine: sparc64
>Description:
A few format-string mistakes, apparently related to the daddr_t change,
that showed up on a build for sparc64 due to and long long's being 128
bits and were treated as errors thanks to -Werror.
>How-To-Repeat:
Build a release for sparc64 (although probably any 64-bit platform will do).
>Fix:
Here's a cvs diff -u against the aforementioned recent -CURRENT:

Index: src/libexec/lfs_cleanerd/cleanerd.c
===================================================================
RCS file: /cvsroot/src/libexec/lfs_cleanerd/cleanerd.c,v
retrieving revision 1.41
diff -u -r1.41 cleanerd.c
--- src/libexec/lfs_cleanerd/cleanerd.c	2003/01/24 21:55:04	1.41
+++ src/libexec/lfs_cleanerd/cleanerd.c	2003/01/28 07:29:24
@@ -754,7 +754,7 @@
 			       tba[i].bi_inode,
 			       tba[i].bi_lbn,
 			       tba[i].bi_daddr,
-			       seg_addr + btofsb(lfsp, (char *)(tba[i].bi_bp) - seg_buf));
+			       (long long)(seg_addr + btofsb(lfsp, (char *)(tba[i].bi_bp) - seg_buf)));
 			error = EFAULT;
 			goto out;
 
Index: src/usr.sbin/dumplfs/dumplfs.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/dumplfs/dumplfs.c,v
retrieving revision 1.20
diff -u -r1.20 dumplfs.c
--- src/usr.sbin/dumplfs/dumplfs.c	2003/01/24 21:55:31	1.20
+++ src/usr.sbin/dumplfs/dumplfs.c	2003/01/28 07:29:24
@@ -476,7 +476,7 @@
 	if (lfsp->lfs_version > 1 && sp->ss_ident != lfsp->lfs_ident) {
 		(void)printf("dumplfs: %s %d address 0x%llx\n",
 	                     "summary from a former life; segment", segnum,
-			     addr);
+			     (long long)addr);
 		return (0);
 	}
 
Index: src/usr.sbin/makefs/ffs/mkfs.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/makefs/ffs/mkfs.c,v
retrieving revision 1.12
diff -u -r1.12 mkfs.c
--- src/usr.sbin/makefs/ffs/mkfs.c	2003/01/24 21:55:33	1.12
+++ src/usr.sbin/makefs/ffs/mkfs.c	2003/01/28 07:29:24
@@ -525,8 +525,8 @@
 	i = MIN(~sblock.fs_cgmask, sblock.fs_ncg - 1);
 	if (cgdmin(&sblock, i) - cgbase(&sblock, i) >= sblock.fs_fpg) {
 		printf("inode blocks/cyl group (%lld) >= data blocks (%d)\n",
-		    (long long)cgdmin(&sblock, i) -
-			cgbase(&sblock, i) / sblock.fs_frag,
+		    (long long)(cgdmin(&sblock, i) -
+			cgbase(&sblock, i) / sblock.fs_frag),
 		    sblock.fs_fpg / sblock.fs_frag);
 		printf("number of cylinders per cylinder group (%d) %s.\n",
 		    sblock.fs_cpg, "must be increased");
@@ -537,8 +537,8 @@
 	    cgdmin(&sblock, j) - cgbase(&sblock, j) > i) {
 		if (j == 0) {
 			printf("File system must have at least %lld sectors\n",
-			    (long long)NSPF(&sblock) *
-			    (cgdmin(&sblock, 0) + 3 * sblock.fs_frag));
+			    (long long)(NSPF(&sblock) *
+			    (cgdmin(&sblock, 0) + 3 * sblock.fs_frag)));
 			exit(30);
 		}
 		printf("Warning: inode blocks/cyl group (%lld) >= "
Index: src/sys/dev/cgd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/cgd.c,v
retrieving revision 1.5
diff -u -r1.5 cgd.c
--- src/sys/dev/cgd.c	2002/11/01 11:31:55	1.5
+++ src/sys/dev/cgd.c	2003/01/28 07:29:25
@@ -339,8 +339,8 @@
 	DPRINTF_FOLLOW(("cgdiodone(%p)\n", vbp));
 	DPRINTF(CGDB_IO, ("cgdiodone: bp %p bcount %ld resid %ld\n",
 	    obp, obp->b_bcount, obp->b_resid));
-	DPRINTF(CGDB_IO, (" dev 0x%x, cbp %p bn %d addr %p bcnt %ld\n",
-	    cbp->cb_buf.b_dev, cbp, cbp->cb_buf.b_blkno, cbp->cb_buf.b_data,
+	DPRINTF(CGDB_IO, (" dev 0x%x, cbp %p bn %lld addr %p bcnt %ld\n",
+	    cbp->cb_buf.b_dev, cbp, (long long)cbp->cb_buf.b_blkno, cbp->cb_buf.b_data,
 	    cbp->cb_buf.b_bcount));
 	s = splbio();
 	if (nbp->b_flags & B_ERROR) {
@@ -465,8 +465,8 @@
 {
 	struct	cgd_softc *cs;
 
-	DPRINTF_FOLLOW(("cgddump(%d, %d, %p, %lu)\n", dev, blkno, va,
-	    (unsigned long)size));
+	DPRINTF_FOLLOW(("cgddump(%d, %lld, %p, %lu)\n", dev, (long long)blkno, va,
+	    (unsigned long )size));
 	GETCGD_SOFTC(cs, dev);
 	return dk_dump(di, &cs->sc_dksc, dev, blkno, va, size);
 }

>Release-Note:
>Audit-Trail:
>Unformatted: