From 3e4a82e559505b5a19d4a142b356cead973ffc55 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 21 Jan 2011 14:20:16 -0800 Subject: [PATCH] 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 --- src/os/FileJournal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 54e0f05039050..54f6bfa09ac96 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) { -- 2.39.5