Date: Mon, 7 Jul 2008 14:21:41 +0200 (CEST) From: Frank Behrens <frank+pr20080707@harz.behrens.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/125365: [patch] mdconfig(8) -l overflow for size field Message-ID: <200807071221.m67CLfhq040174@moon.behrens> Resent-Message-ID: <200807071230.m67CU41N073953@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 125365 >Category: bin >Synopsis: [patch] mdconfig(8) -l overflow for size field >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 07 12:30:03 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Frank Behrens >Release: FreeBSD 7.0-STABLE-200805150513 i386 >Organization: >Environment: >Description: mdconfig(8) shows with -l -v the size of configured device. For devices with size > ULONG_MAX no number is shown. >How-To-Repeat: Configute a bigger md device and show details: # cd /tmp # truncate -s 1G s.tmp # truncate -s 10G b.tmp # mdconfig -a -t vnode -f s.tmp -u 100 # mdconfig -a -t vnode -f b.tmp -u 101 # mdconfig -l -u 100 1.0G /tmp/s.tmp # mdconfig -l -u 101 /tmp/b.tmp # mdconfig -d -u 100 # mdconfig -d -u 101 # rm s.tmp b.tmp >Fix: --- mdconfig_overflow.patch begins here --- --- mdconfig.c.orig 2008-07-05 17:05:27.481413000 +0200 +++ mdconfig.c 2008-07-07 14:02:04.355862796 +0200 @@ -444,11 +444,11 @@ md_prthumanval(char *length) { char buf[6]; - uint64_t bytes; + unsigned long long bytes; char *endptr; - bytes = strtoul(length, &endptr, 10); - if (bytes == (unsigned)ULONG_MAX || *endptr != '\0') + bytes = strtoull(length, &endptr, 10); + if (bytes == (unsigned)ULLONG_MAX || *endptr != '\0') return; humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1), bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); --- mdconfig_overflow.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807071221.m67CLfhq040174>