]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Journaler.cc: fix integer overflow
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 17 Jun 2015 17:53:42 +0000 (19:53 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 17 Jul 2015 08:50:45 +0000 (10:50 +0200)
Fix for:

CID 1297861 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
 overflow_before_widen: Potentially overflowing expression
  this->layout.fl_stripe_count.operator __u32() *
  this->layout.fl_object_size.operator __u32() with type unsigned int
  (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used
  in a context that expects an expression of type uint64_t (64 bits, unsigned).

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/osdc/Journaler.cc

index 3daea9400a51d9271c8f91a55c99832ae0034954..2229a9e08daca05a90d1b85deb637e5e34c332e5 100644 (file)
@@ -55,7 +55,7 @@ void Journaler::create(ceph_file_layout *l, stream_format_t const sf)
 
   prezeroing_pos = prezero_pos = write_pos = flush_pos = safe_pos =
     read_pos = requested_pos = received_pos =
-    expire_pos = trimming_pos = trimmed_pos = layout.fl_stripe_count * layout.fl_object_size;
+    expire_pos = trimming_pos = trimmed_pos = (uint64_t)layout.fl_stripe_count * layout.fl_object_size;
 
   ldout(cct, 1) << "created blank journal at inode 0x" << std::hex << ino << std::dec
     << ", format=" << stream_format << dendl;