From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
James Bottomley <JBottomley@Odin.com>,
linux-kernel@vger.kernel.org,
"K. Y. Srinivasan" <kys@microsoft.com>
Subject: Re: [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests
Date: Wed, 21 Oct 2015 12:19:13 +0200 [thread overview]
Message-ID: <87eggor0bi.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <1442483044-9401-3-git-send-email-vkuznets@redhat.com> (Vitaly Kuznetsov's message of "Thu, 17 Sep 2015 11:44:04 +0200")
On Thu, Sep 17 2015, Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
> +
> +static __init void test_string_get_size(void)
> +{
> + test_string_get_size_one(16384, 512, STRING_UNITS_2, "8.00 MiB");
> + test_string_get_size_one(8192, 4096, STRING_UNITS_10, "32.7 MB");
This is a little late, but I just noticed that string_get_size with
STRING_UNITS_10, block size >= 1024 and sufficiently large size seems to
be broken. Yes, 32.7 MB is what it produces, but is it what it should
give? 8192*4096 = 33554432, so I'd expect "33.5 MB". It does give that
when we pass size=65536 and block_size=512; a combination with the same
product.
I think the problem is that the remainder coming out of the while
(blk_size >= divisor[units]) loop is dropped on the floor in the
subsequent size > exp case - but I'm too lazy right now to figure out how
to fix it.
Rasmus
next prev parent reply other threads:[~2015-10-21 10:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 9:44 [PATCH v5 0/2] lib/string_helpers.c: fix infinite loop in string_get_size() Vitaly Kuznetsov
2015-09-17 9:44 ` [PATCH v5 1/2] " Vitaly Kuznetsov
2015-09-17 9:44 ` [PATCH v5 2/2] lib/test-string_helpers.c: add string_get_size() tests Vitaly Kuznetsov
2015-10-21 10:19 ` Rasmus Villemoes [this message]
2015-10-23 12:31 ` Vitaly Kuznetsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eggor0bi.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=JBottomley@Odin.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=kys@microsoft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).