]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: cast rgw_max_chunk_size to off_t 40841/head
authorKefu Chai <kchai@redhat.com>
Thu, 15 Apr 2021 05:31:25 +0000 (13:31 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 15 Apr 2021 05:34:33 +0000 (13:34 +0800)
as the left-hand operator is promoted to off_t which is a signed
integer, while rgw_max_chunk_size will be an unsigned after the
yaml-to-cxx migration. so let's cast it to `off_t` before comparing
them.

the same applies to rgw_copy_obj_progress_every_bytes.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_compression.cc
src/rgw/rgw_op.cc

index 2eaf9da30d50953ee2fc342b7111f224959da984..fedc46765a5cd88367f3edaae4ecba4e971caed4 100644 (file)
@@ -141,8 +141,8 @@ int RGWGetObj_Decompress::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len
       return cr;
     }
     ++first_block;
-    while (out_bl.length() - q_ofs >= cct->_conf->rgw_max_chunk_size)
-    {
+    while (out_bl.length() - q_ofs >=
+          static_cast<off_t>(cct->_conf->rgw_max_chunk_size)) {
       off_t ch_len = std::min<off_t>(cct->_conf->rgw_max_chunk_size, q_len);
       q_len -= ch_len;
       r = next->handle_data(out_bl, q_ofs, ch_len);
index f25adc06e50e1cc238d74cf075a2a2ba43fd02e3..1bb805ed6a983e41f8b740a7d6cec45f0eba06ec 100644 (file)
@@ -5053,8 +5053,10 @@ void RGWCopyObj::progress_cb(off_t ofs)
   if (!s->cct->_conf->rgw_copy_obj_progress)
     return;
 
-  if (ofs - last_ofs < s->cct->_conf->rgw_copy_obj_progress_every_bytes)
+  if (ofs - last_ofs <
+      static_cast<off_t>(s->cct->_conf->rgw_copy_obj_progress_every_bytes)) {
     return;
+  }
 
   send_partial_response(ofs);