From: Kefu Chai Date: Tue, 28 Mar 2017 18:05:07 +0000 (+0800) Subject: rbd: use min() explicitly X-Git-Tag: v12.0.2~262^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2ad4aa0c2a95df0d46e9b3d76682e4c772ad8fea;p=ceph.git rbd: use min() explicitly on arm32, size_t is actually int, which cannot be compared with uint64_t using std::min(). Fixes: http://tracker.ceph.com/issues/18938 Signed-off-by: Kefu Chai --- diff --git a/src/tools/rbd/action/Import.cc b/src/tools/rbd/action/Import.cc index f012bbbf0b59..5b9df1271bd9 100644 --- a/src/tools/rbd/action/Import.cc +++ b/src/tools/rbd/action/Import.cc @@ -259,13 +259,13 @@ static int skip_tag(int fd, uint64_t length) if (fd == STDIN_FILENO) { // read the appending data out to skip this tag. char buf[4096]; - uint64_t len = min(length, sizeof(buf)); + uint64_t len = min(length, sizeof(buf)); while (len > 0) { r = safe_read_exact(fd, buf, len); if (r < 0) return r; length -= len; - len = min(length, sizeof(buf)); + len = min(length, sizeof(buf)); } } else { // lseek to skip this tag @@ -606,7 +606,7 @@ static int do_import_v1(int fd, librbd::Image &image, uint64_t size, max(g_conf->rbd_concurrent_management_ops, 1), false)); } - reqlen = min(reqlen, size); + reqlen = min(reqlen, size); // loop body handles 0 return, as we may have a block to flush while ((readlen = ::read(fd, p + blklen, reqlen)) >= 0) { if (throttle->pending_error()) {