From stefan@fafoe.dyndns.org  Sat Jan 18 06:13:02 2003
Return-Path: <stefan@fafoe.dyndns.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D249437B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Jan 2003 06:13:02 -0800 (PST)
Received: from fafoe.dyndns.org (chello212186121237.14.vie.surfer.at [212.186.121.237])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3B56143EB2
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 18 Jan 2003 06:13:02 -0800 (PST)
	(envelope-from stefan@fafoe.dyndns.org)
Received: from frog.fafoe (frog.fafoe [192.168.2.101])
	by fafoe.dyndns.org (Postfix) with ESMTP
	id 123C54159; Sat, 18 Jan 2003 15:12:52 +0100 (CET)
Received: by frog.fafoe (Postfix, from userid 1001)
	id 4575E7CE; Sat, 18 Jan 2003 15:12:52 +0100 (CET)
Message-Id: <20030118141252.4575E7CE@frog.fafoe>
Date: Sat, 18 Jan 2003 15:12:52 +0100 (CET)
From: Stefan Farfeleder <stefan@fafoe.dyndns.org>
Reply-To: Stefan Farfeleder <stefan@fafoe.dyndns.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: stefan@fafoe.dyndns.org
Subject: [patch] fix printf specifier in src/sys/boot/common/bcache.c
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         47187
>Category:       kern
>Synopsis:       [patch] fix printf specifier in src/sys/boot/common/bcache.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    stefanf
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 18 06:20:01 PST 2003
>Closed-Date:    Sun Oct 03 16:34:42 GMT 2004
>Last-Modified:  Sun Oct 03 16:34:42 GMT 2004
>Originator:     Stefan Farfeleder
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD frog.fafoe 5.0-CURRENT FreeBSD 5.0-CURRENT #11: Fri Jan 17 23:42:54 CET 2003 freebsd@frog.fafoe:/freebsd/current/obj/freebsd/current/src/sys/FROG i386


	
>Description:
The bc_blkno member of struct bcachectl which has type daddr_t
(a typedef for __int64_t from <sys/types.h>) is printed with %08x which
expects a value with type unsigned int to be passed.  The patch casts
the expression to uintmax_t and the specifier is changed to %08jx.

>How-To-Repeat:
A make buildworld gives this warning:

cc -O -pipe -mcpu=pentiumpro -ffreestanding -DLOADER_NFS_SUPPORT -DBOOT_FORTH -I/freebsd/current/src/sys/boot/i386/loader/../../ficl -I/freebsd/current/src/sys/boot/i386/loader/../../ficl/i386 -DLOADER_GZIP_SUPPORT -I/freebsd/current/src/sys/boot/i386/loader/../../common -I/freebsd/current/src/sys/boot/i386/loader/../../.. -I. -Wall -I/freebsd/current/src/sys/boot/i386/loader/.. -I/freebsd/current/src/sys/boot/i386/loader/../../../../lib/libstand/ -I/freebsd/current/src/sys/boot/i386/loader/../btx/lib -elf -ffreestanding -mpreferred-stack-boundary=2 -ffreestanding -mpreferred-stack-boundary=2    -c /freebsd/current/src/sys/boot/common/bcache.c
/freebsd/current/src/sys/boot/common/bcache.c: In function `command_bcache':
/freebsd/current/src/sys/boot/common/bcache.c:339: warning: unsigned int format, different type arg (arg 2)

>Fix:

--- bcache.c.diff begins here ---
Index: src/sys/boot/common/bcache.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/boot/common/bcache.c,v
retrieving revision 1.11
diff -c -r1.11 bcache.c
*** src/sys/boot/common/bcache.c	25 Feb 2002 03:45:09 -0000	1.11
--- src/sys/boot/common/bcache.c	18 Jan 2003 14:03:59 -0000
***************
*** 30,35 ****
--- 30,36 ----
   * Simple LRU block cache
   */
  
+ #include <sys/stdint.h>
  #include <stand.h>
  #include <string.h>
  #include <bitstring.h>
***************
*** 336,342 ****
      u_int	i;
      
      for (i = 0; i < bcache_nblks; i++) {
! 	printf("%08x %04x %04x|", bcache_ctl[i].bc_blkno, (unsigned int)bcache_ctl[i].bc_stamp & 0xffff, bcache_ctl[i].bc_count & 0xffff);
  	if (((i + 1) % 4) == 0)
  	    printf("\n");
      }
--- 337,343 ----
      u_int	i;
      
      for (i = 0; i < bcache_nblks; i++) {
! 	printf("%08jx %04x %04x|", (uintmax_t)bcache_ctl[i].bc_blkno, (unsigned int)bcache_ctl[i].bc_stamp & 0xffff, bcache_ctl[i].bc_count & 0xffff);
  	if (((i + 1) % 4) == 0)
  	    printf("\n");
      }
--- bcache.c.diff ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->stefanf 
Responsible-Changed-By: stefanf 
Responsible-Changed-When: Thu May 6 07:27:36 PDT 2004 
Responsible-Changed-Why:  
Over to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47187 
State-Changed-From-To: open->closed 
State-Changed-By: stefanf 
State-Changed-When: Sun Oct 3 16:34:34 GMT 2004 
State-Changed-Why:  
Committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47187 
>Unformatted:
