From: Greg Farnum Date: Fri, 21 Jan 2011 22:20:16 +0000 (-0800) Subject: FileJournal: don't overflow the journal size. X-Git-Tag: v0.24.2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3e4a82e559505b5a19d4a142b356cead973ffc55;p=ceph.git FileJournal: don't overflow the journal size. Previously we were casting it to a uint64_t, but the left shift occurs before the cast, so we were overflowing in some circumstances. Split these up to prevent it. Signed-off-by: Greg Farnum --- diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 54e0f050390..54f6bfa09ac 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -223,7 +223,8 @@ int FileJournal::_open_file(int64_t oldsize, blksize_t blksize, } if (create && (oldsize < conf_journal_sz)) { - uint64_t newsize = (uint64_t)g_conf.osd_journal_size << 20; + uint64_t newsize(g_conf.osd_journal_size); + newsize <<= 20; dout(10) << "_open extending to " << newsize << " bytes" << dendl; ret = ::ftruncate(fd, newsize); if (ret < 0) {