From patchwork Thu Jun 23 17:07:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bill O'Donnell X-Patchwork-Id: 9195613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 301156075A for ; Thu, 23 Jun 2016 17:07:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19EE12845C for ; Thu, 23 Jun 2016 17:07:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CE1E283FB; Thu, 23 Jun 2016 17:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from oss.sgi.com (oss.sgi.com [192.48.182.195]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A554E283FB for ; Thu, 23 Jun 2016 17:07:21 +0000 (UTC) Received: from oss.sgi.com (localhost [IPv6:::1]) by oss.sgi.com (Postfix) with ESMTP id 310DA7CA2; Thu, 23 Jun 2016 12:07:18 -0500 (CDT) X-Original-To: xfs@oss.sgi.com Delivered-To: xfs@oss.sgi.com Received: from relay.sgi.com (relay1.corp.sgi.com [137.38.102.111]) by oss.sgi.com (Postfix) with ESMTP id 9484C7CA1 for ; Thu, 23 Jun 2016 12:07:16 -0500 (CDT) Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by relay1.corp.sgi.com (Postfix) with ESMTP id 6759C8F8033 for ; Thu, 23 Jun 2016 10:07:13 -0700 (PDT) X-ASG-Debug-ID: 1466701631-04cb6c063f1163c0001-NocioJ Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by cuda.sgi.com with ESMTP id S7DXQ5NHI5gcMIS2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 23 Jun 2016 10:07:12 -0700 (PDT) X-Barracuda-Envelope-From: billodo@redhat.com X-Barracuda-Effective-Source-IP: mx1.redhat.com[209.132.183.28] X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-ASG-Whitelist: Client Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A60DB3F745 for ; Thu, 23 Jun 2016 17:07:11 +0000 (UTC) Received: from localhost.localdomain.com (vpn-49-102.rdu2.redhat.com [10.10.49.102]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5NH7Blk024982 for ; Thu, 23 Jun 2016 13:07:11 -0400 From: "Bill O'Donnell" To: xfs@oss.sgi.com Subject: [PATCH] xfs_repair: resolve Coverity OVERFLOW_BEFORE_WIDEN Date: Thu, 23 Jun 2016 12:07:10 -0500 X-ASG-Orig-Subj: [PATCH] xfs_repair: resolve Coverity OVERFLOW_BEFORE_WIDEN Message-Id: <1466701630-6380-1-git-send-email-billodo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 Jun 2016 17:07:11 +0000 (UTC) X-Barracuda-Connect: mx1.redhat.com[209.132.183.28] X-Barracuda-Start-Time: 1466701632 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 X-Barracuda-URL: https://192.48.176.15:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 874 X-Virus-Scanned: by bsmtpd at sgi.com X-Barracuda-BRTS-Status: 1 X-BeenThere: xfs@oss.sgi.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: XFS Filesystem from SGI List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Eric Sandeen --- 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); }