Received: by 10.223.176.5 with SMTP id f5csp909865wra; Tue, 30 Jan 2018 21:53:28 -0800 (PST) X-Google-Smtp-Source: AH8x227LJkuU3yWT4fmZivyk2VextVHCXNpc22P/bfxP6Nr0bKaWVZqeT7rnzSiuMNz2vsAm9woA X-Received: by 10.99.140.72 with SMTP id q8mr24985085pgn.51.1517378007941; Tue, 30 Jan 2018 21:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517378007; cv=none; d=google.com; s=arc-20160816; b=ckFYkt1VL4VVoSvhS3GpyWiyMQ7Uth5I0CFSr98RocHfAnCyP4+z7PMJUWDqacaJSe 9DYg5wCKUslmd4S2j4+D48n1eIrwbXFf8IfDKeWgseLReFtYgbww7XCcCOjkLLMSoauI 1sJ7T9TnhCJl53MpT/Xien44u4/HV1pdBVzqhg8YH3rOR3vd3Q4PEYwxtm39lxuE81HE mEk9m/gT061Y+erPPN/N6Qycv+mjhKiXtyADQYsrcKlxjVWYdNnMT4HSQYaRg7DeTvf9 U/b7j0Rbgzdsxvr8E/6QoHl1YOGJnn2QOANl2OBvADBlcn4Ab/XuFrP4DaETCHdXTXgu mxAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=c6/hMicoJf828jaohtxAtTj4W5Asqf70pZ9Tb+mRM/w=; b=QsOHPAAP0SouvO6F2h11+de65onTvQvMy4RjjmjjG9Xa2cxgnVF9OFywunx6J+sluA jA/3rIN4oGXEKjV+ALm+IMXFKdVS4OppiHueNsZSb4oe6QVtfNWIUJilTLAY554QlpjD 7QX/IUt+Zjm1dOx5Ihj9q7Fn7KImoPcWnhAcg2EPteAekk/kRnDtr8RRYS1770LhicjH ikDmBQf9VYg54tMArSXPWtd/qNInd0CJepCmxKioi50Rb/6YBNH3AgMUERXGECuwETwQ 8xi3TSuFMpyiKZXxSYeTiWmvxP11mJu1nAaX5lAEwLdK43Ea8l1+gujC6Rcj3fGZ6cHm zMug== 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 s7-v6si3639432plp.57.2018.01.30.21.53.11; Tue, 30 Jan 2018 21:53:27 -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 S1751587AbeAaF3x (ORCPT + 99 others); Wed, 31 Jan 2018 00:29:53 -0500 Received: from gateway32.websitewelcome.com ([192.185.144.98]:15087 "EHLO gateway32.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbeAaF3w (ORCPT ); Wed, 31 Jan 2018 00:29:52 -0500 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 096BDAFA9E for ; Tue, 30 Jan 2018 23:29:52 -0600 (CST) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id gkxzea1mDBUMKgky0eeSk3; Tue, 30 Jan 2018 23:29:52 -0600 Received: from [189.152.201.65] (port=56046 helo=embeddedgus) by gator4166.hostgator.com with esmtpa (Exim 4.89_1) (envelope-from ) id 1egkxz-002zhY-J3; Tue, 30 Jan 2018 23:29:51 -0600 Date: Tue, 30 Jan 2018 23:29:48 -0600 From: "Gustavo A. R. Silva" To: Ilya Dryomov , "Yan, Zheng" , Sage Weil , "David S. Miller" Cc: ceph-devel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH] libceph: use 64-bit arithmetic instead of 32-bit Message-ID: <20180131052948.GA16419@embeddedgus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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: 189.152.201.65 X-Source-L: No X-Exim-ID: 1egkxz-002zhY-J3 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedgus) [189.152.201.65]:56046 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 7 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 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 */ -- 2.7.4