This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch master
in repository gfs2-utils.
commit dd314bd9df1f93d2608f50da7d73bf5d1ad99abc
Author: Andrew Price <anprice(a)redhat.com>
Date: Wed Mar 7 11:42:36 2018 +0000
gfs2-utils: Avoid some more potential in overflows
Spotted by coverity.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 2 +-
gfs2/fsck/rgrepair.c | 2 +-
gfs2/libgfs2/misc.c | 2 +-
gfs2/libgfs2/rgrp.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 25fd7bc..04f1221 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -744,7 +744,7 @@ static void get_journal_inode_blocks(void)
break;
gfs_jindex_in(&ji, jbuf);
jblock = ji.ji_addr;
- gfs1_journal_size = ji.ji_nsegment * 16;
+ gfs1_journal_size = (uint64_t)ji.ji_nsegment * 16;
} else {
if (journal > indirect->ii[0].dirents - 3)
break;
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index e45a649..2f14590 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -341,7 +341,7 @@ static uint64_t find_next_rgrp_dist(struct gfs2_sbd *sdp, uint64_t
blk,
return rgrp_dist;
}
mega_in_blocks = (1024 * 1024) / sdp->bsize;
- twogigs = 2048 * mega_in_blocks;
+ twogigs = (uint64_t)mega_in_blocks * 2048;
/* Unfortunately, if we fall through to here we can't trust the
rindex. So we have to analyze the current rgrp to figure out
the bare minimum block number where it ends. If we don't have
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index f6ae74c..6dfd9af 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -16,7 +16,7 @@ int compute_heightsize(unsigned bsize, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs)
{
heightsize[0] = bsize - sizeof(struct gfs2_dinode);
- heightsize[1] = bsize1 * diptrs;
+ heightsize[1] = (uint64_t)bsize1 * diptrs;
for (*maxheight = 2;; (*maxheight)++) {
uint64_t space, d;
uint32_t m;
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index 2d4fb78..b61c593 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -384,7 +384,7 @@ uint32_t lgfs2_rgrps_plan(const lgfs2_rgrps_t rgs, uint64_t space,
uint32_t tgts
over all of the rgrps so that we don't end with a single
tiny one. */
rgs->plan[0].num++;
- while (((rgs->plan[0].len - adj) * (rgs->plan[0].num)) >= space)
+ while (((rgs->plan[0].len - adj) * (uint64_t)rgs->plan[0].num) >= space)
rgs->plan[0].len -= adj;
/* We've adjusted the size of the rgrps down as far as we can
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date