Received: by 10.223.176.5 with SMTP id f5csp1296734wra; Wed, 31 Jan 2018 04:25:42 -0800 (PST) X-Google-Smtp-Source: AH8x224sVaKw0sxi/bfO7tYMAB1Th3qc9MvhvoiiHnIBgO42yq/wAExpU2YMDdpRhzEj8hUDG6aH X-Received: by 10.98.227.8 with SMTP id g8mr33241936pfh.164.1517401542264; Wed, 31 Jan 2018 04:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517401542; cv=none; d=google.com; s=arc-20160816; b=gpbA+mdaWyQaPAKaWkFIIzXtzcJfGee2ZbFQU7yItCw38leHSNSMsLZBMpQ1eru2Tg ihT1hvWF+62vCEyWGm+O0jiemHS2JO/w0QuphbJh35SOeWxtW3EwQC7CbPjgA9oGKE0y WksoTDvdwAbZ7K7wlLu13Gc5uk4uiZZ9eFIkniDqJkbHSBva0dkEPV1GA3ptBns+R6l5 vVvQmS7yCmqLDCfMDjTEqg+oh71uRYmjKTzBoOUIDlFow3zM1/xgws/+stj+e6H8duj1 23+vrk2BBDWO1bIybRBOXbE488kVGKY7c5dupAKYFAe7LTtounSqYguGn+wzx6teMpMQ FOAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :user-agent:in-reply-to:references:subject:cc:to:from:message-id :date:arc-authentication-results; bh=cKlRutcx8oQImTUmd5I0EwOOROYgdtr8QLIxODf2kLA=; b=O8O/eGiO5CAAgLpj30xZjk30PggQfLHb8oZNkF8Ggf3fnTAkAZGButTxOlOK/CeeFA oRsrhK4MFu4aio+p7btmb6A4nOAdjIcl7lhtuOPpBbboxIC4NAwsyvBq7zrUj3mXvoFz QrH/3KS7whd+DVAZErXXcH2B2gG7kRF0TxUbm6AM8kXRYOvGBiD5R45fogElRSqt64C0 3rlZiWEOtwSXWF3RJUFjbxV6sK8qN2Zt5Jh7Y16GgXXLpkJgYThNmRBSMVXX5cw3HBJu cwbz47aseS2dM8l4yCS5yELd1dg9NlMD/v+nJU3UW0JyPabwoBALVvtJzGDnS3Xqfc9U k7cA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t16si2843504pgb.273.2018.01.31.04.25.27; Wed, 31 Jan 2018 04:25:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752876AbeAaMZG (ORCPT + 99 others); Wed, 31 Jan 2018 07:25:06 -0500 Received: from gateway30.websitewelcome.com ([192.185.179.30]:17661 "EHLO gateway30.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752061AbeAaMZF (ORCPT ); Wed, 31 Jan 2018 07:25:05 -0500 X-Greylist: delayed 1331 seconds by postgrey-1.27 at vger.kernel.org; Wed, 31 Jan 2018 07:25:05 EST Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway30.websitewelcome.com (Postfix) with ESMTP id DC00D13438 for ; Wed, 31 Jan 2018 06:02:53 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id gr6Le4C1p0aRHgr6LePiCC; Wed, 31 Jan 2018 06:02:53 -0600 Received: from gator4166.hostgator.com ([108.167.133.22]:28785) by gator4166.hostgator.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1egr6L-000sYZ-EG; Wed, 31 Jan 2018 06:02:53 -0600 Received: from 189.152.201.65 ([189.152.201.65]) by gator4166.hostgator.com (Horde Framework) with HTTPS; Wed, 31 Jan 2018 06:02:53 -0600 Date: Wed, 31 Jan 2018 06:02:53 -0600 Message-ID: <20180131060253.Horde.vxLJv9n9JFz_lxqApXvdkZX@gator4166.hostgator.com> From: "Gustavo A. R. Silva" To: Ilya Dryomov Cc: "Gustavo A. R. Silva" , "Yan, Zheng" , Sage Weil , "David S. Miller" , Ceph Development , netdev , linux-kernel@vger.kernel.org Subject: Re: [PATCH] libceph: use 64-bit arithmetic instead of 32-bit References: <20180131052948.GA16419@embeddedgus> In-Reply-To: User-Agent: Horde Application Framework 5 Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes MIME-Version: 1.0 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 108.167.133.22 X-Source-L: Yes X-Exim-ID: 1egr6L-000sYZ-EG X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: gator4166.hostgator.com [108.167.133.22]:28785 X-Source-Auth: garsilva@embeddedor.com X-Email-Count: 1 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Ilya, Quoting Ilya Dryomov : > On Wed, Jan 31, 2018 at 6:29 AM, Gustavo A. R. Silva > wrote: >> Cast objsetno to u64 in order to give the compiler complete >> information about the proper arithmetic to use. Notice >> that this variable is used in a context that expects an >> expression of type u64 (64 bits, unsigned). >> >> The expression objsetno * sc + stripepos is currently >> being evaluated using 32-bit arithmetic. >> >> In general, the use of incorrect arithmetic has security >> implications. >> >> Addresses-Coverity-ID: 200686 >> Signed-off-by: Gustavo A. R. Silva >> --- >> net/ceph/osdmap.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c >> index 0da27c6..58dc965 100644 >> --- a/net/ceph/osdmap.c >> +++ b/net/ceph/osdmap.c >> @@ -2183,7 +2183,7 @@ int ceph_calc_file_object_mapping(struct >> ceph_file_layout *layout, >> stripepos = bl % sc; >> objsetno = stripeno / su_per_object; >> >> - *ono = objsetno * sc + stripepos; >> + *ono = (u64)objsetno * sc + stripepos; >> dout("objset %u * sc %u = ono %u\n", objsetno, sc, >> (unsigned int)*ono); >> >> /* *oxoff = *off % layout->fl_stripe_unit; # offset in su */ > > Hi Gustavo, > > This (and other u32/u64 issues in this function, is this the only > warning?) is fixed in my striping v2 work branch. I wasn't going to > push that patch separately, but I guess I should post it. > Yeah, this was the only one warning reported by Coverity in this particular module. Thanks -- Gustavo