Date: Thu, 22 Apr 2004 09:45:23 -0400 (EDT) From: Ken Stailey <kstailey@yahoo.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: tjr@FreeBSD.org Subject: bin/65889: vmstat needs to use unsigned printf for forkstats Message-ID: <200404221345.i3MDjNdG006085@bsdlab.tf-md.net> Resent-Message-ID: <200404221350.i3MDoIvq040468@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 65889 >Category: bin >Synopsis: vmstat needs to use unsigned printf for forkstats >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Apr 22 06:50:18 PDT 2004 >Closed-Date: >Last-Modified: >Originator: Ken Stailey >Release: FreeBSD 5.2.1-RELEASE-p3 i386 >Organization: self >Environment: System: FreeBSD bsdlab.tf-md.net 5.2.1-RELEASE-p3 FreeBSD 5.2.1-RELEASE-p3 #7: Sun Mar 21 10:31:17 EST 2004 kstailey@bsdlab.tf-md.net:/usr/obj/usr/src/sys/BSDLAB i386 >Description: <sys/vmmeter.h> uses u_int but vmsstat.c printf's with %d not %u. Causes signed overflow on busy systems. >How-To-Repeat: Run "vmstat -f" on a busy nameserver or other system with a piggy daemon that forks a lot. >Fix: Index: vmstat.c =================================================================== RCS file: /u1/cvsup/FreeBSD-cvs/root/src/src/usr.bin/vmstat/vmstat.c,v retrieving revision 1.69 diff -u -r1.69 vmstat.c --- vmstat.c 9 Nov 2003 20:39:56 -0000 1.69 +++ vmstat.c 22 Apr 2004 13:40:28 -0000 @@ -654,15 +654,15 @@ { kread(X_SUM, &sum, sizeof(sum)); - (void)printf("%d forks, %d pages, average %.2f\n", + (void)printf("%u forks, %u pages, average %.2f\n", sum.v_forks, sum.v_forkpages, sum.v_forks == 0 ? 0.0 : (double)sum.v_forkpages / sum.v_forks); - (void)printf("%d vforks, %d pages, average %.2f\n", + (void)printf("%u vforks, %u pages, average %.2f\n", sum.v_vforks, sum.v_vforkpages, sum.v_vforks == 0 ? 0.0 : (double)sum.v_vforkpages / sum.v_vforks); - (void)printf("%d rforks, %d pages, average %.2f\n", + (void)printf("%u rforks, %u pages, average %.2f\n", sum.v_rforks, sum.v_rforkpages, sum.v_rforks == 0 ? 0.0 : (double)sum.v_rforkpages / sum.v_rforks); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404221345.i3MDjNdG006085>