bin/146046: [kld] [patch] kldstat(8) contains an obsolete cast

Alexander Best alexbestms at wwu.de
Sun Apr 25 19:30:03 UTC 2010


>Number:         146046
>Category:       bin
>Synopsis:       [kld] [patch] kldstat(8) contains an obsolete cast
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 25 19:30:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Best
>Release:        9.0-CURRENT
>Organization:
>Environment:
FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r207154M: Sat Apr 24 21:14:37 CEST 2010     root at otaku:/usr/obj/usr/src/sys/ARUNDEL  amd64
>Description:
7 years ago a cast of stat.size to uintmax_t in order to make kldstat.c WARNS=5 clean was introduced [1]. it appears that back then printf(3) couldn't handle size_t. since nowadays printf(3) is able to, make use of it. with the removal of the cast to uintmax_t inclusion of stdint.h is no longer required.

[1] in revision 113933
>How-To-Repeat:

>Fix:
apply the attached patch.

Patch attached with submission follows:

Index: sbin/kldstat/kldstat.c
===================================================================
--- sbin/kldstat/kldstat.c	(revision 207014)
+++ sbin/kldstat/kldstat.c	(working copy)
@@ -28,7 +28,6 @@
 __FBSDID("$FreeBSD$");
 
 #include <err.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -60,8 +59,8 @@
     if (kldstat(fileid, &stat) < 0)
 	warn("can't stat file id %d", fileid);
     else
-	printf("%2d %4d %p %-8jx %s",
-	       stat.id, stat.refs, stat.address, (uintmax_t)stat.size, 
+	printf("%2d %4d %p %-8zx %s",
+	       stat.id, stat.refs, stat.address, stat.size,
 	       stat.name);
 
     if (verbose) {


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


More information about the freebsd-bugs mailing list