public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bill O'Donnell" <billodo@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfs_repair: resolve Coverity OVERFLOW_BEFORE_WIDEN
Date: Thu, 23 Jun 2016 12:07:10 -0500	[thread overview]
Message-ID: <1466701630-6380-1-git-send-email-billodo@redhat.com> (raw)

Coverity complains that when multiplying two 32 bit values that
eventually will be stored in a 64 bit value that it's possible
the math could overflow unless one of the values being multiplied
is type cast to the proper size.

Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
 repair/sb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/repair/sb.c b/repair/sb.c
index 3965953..8d4843c 100644
--- a/repair/sb.c
+++ b/repair/sb.c
@@ -230,7 +230,7 @@ find_secondary_sb(xfs_sb_t *rsb)
 	do_warn(_("\nattempting to find secondary superblock...\n"));
 
 	if (verify_sb_blocksize(rsb) == 0) {
-		skip = rsb->sb_agblocks * rsb->sb_blocksize;
+		skip = (__uint64_t)rsb->sb_agblocks * rsb->sb_blocksize;
 		if (skip >= XFS_AG_MIN_BYTES && skip <= XFS_AG_MAX_BYTES)
 			retval = __find_secondary_sb(rsb, skip, skip);
 	}
-- 
2.7.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

             reply	other threads:[~2016-06-23 17:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 17:07 Bill O'Donnell [this message]
2016-06-23 17:35 ` [PATCH] xfs_repair: resolve Coverity OVERFLOW_BEFORE_WIDEN Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466701630-6380-1-git-send-email-billodo@redhat.com \
    --to=billodo@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox