From: Bart Van Assche <bvanassche@acm.org>
To: Theodore Ts'o <tytso@mit.edu>, linux-block@vger.kernel.org
Subject: Re: [PATCH blktests] Fix build failure for discontiguous-io on 32-bit platforms
Date: Mon, 29 Oct 2018 09:26:43 -0700 [thread overview]
Message-ID: <1540830403.196084.50.camel@acm.org> (raw)
In-Reply-To: <20181029161534.7564-1-tytso@mit.edu>
On Mon, 2018-10-29 at 12:15 -0400, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
> src/discontiguous-io.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/discontiguous-io.cpp b/src/discontiguous-io.cpp
> index 5e0ee0f..a59c18d 100644
> --- a/src/discontiguous-io.cpp
> +++ b/src/discontiguous-io.cpp
> @@ -291,7 +291,7 @@ int main(int argc, char **argv)
> unsigned char *p = &*buf.begin();
> for (int i = 0; i < len / 4; i++)
> iov.append(p + 4 + i * 8,
> - std::min(4ul, len - i * 4));
> + std::min(4ul, (unsigned long) len - i * 4));
> } else {
> iov.append(&*buf.begin(), buf.size());
> }
Hi Ted,
Have you considered to change the data type of 'len' from size_t into unsigned long
instead of inserting this cast? That would make it clear that no integer truncation
happens in the iov.append() call.
Thanks,
Bart.
next prev parent reply other threads:[~2018-10-30 1:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-29 16:15 [PATCH blktests] Fix build failure for discontiguous-io on 32-bit platforms Theodore Ts'o
2018-10-29 16:26 ` Bart Van Assche [this message]
2018-10-29 21:08 ` Theodore Y. Ts'o
2018-10-29 21:32 ` Bart Van Assche
2018-10-29 23:22 ` Theodore Y. Ts'o
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=1540830403.196084.50.camel@acm.org \
--to=bvanassche@acm.org \
--cc=linux-block@vger.kernel.org \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.