Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp284678rwj; Thu, 22 Dec 2022 07:44:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXsjpNWw51xWUAIT6oEfeWWmtx4wZyT2GXSef9jdpAxx9mP7GgksepfULthX4kGAWsKRnnCb X-Received: by 2002:a05:6402:33a:b0:45c:835c:3695 with SMTP id q26-20020a056402033a00b0045c835c3695mr5241928edw.30.1671723874442; Thu, 22 Dec 2022 07:44:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671723874; cv=none; d=google.com; s=arc-20160816; b=RcR2fW0t2g0uSfaR/+VUCy3kqlUF8nacdyDH3nhtZRugSmjHnANCTvGBy05o4vr6F3 aNgrg2975ARXpEZNv/EZ4OnbmwCduqCM+TYjMQJsAK1hp/SQxBOnU1RPwrdX+1X9hYa2 upOtFOqow6pc44ySgBeq1UfOW0Iiprr4vtAO658guo0ddGecimNpcu/bH4kxbsLa1/ea FHNffidX0M3yPN68JidzafCTsUHEe70XQ91dW4V0rYJvu36AaBq6u6HaHz7g8kJoFNrA Wl5PVhDbu0qg5KClT1q5nGL39cNu1iPdtrbvM06dCHPduC/31vql628NzZ9CctEWETcz hKkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6aq1q2dZE1f9PHYhI1/TolewY6B0THId9Crgx3QOrpM=; b=Wr3B8FPq2KqK1B5yxxG6AwbA+Qd3Yyfg4v1OMX5bFeHwoOcs+qDI/t3koaZG8RYqfG Oe+dncZJke8myFsLDWKb4cVSeZMxgV3g5jTU2SAOy6KhDZLSD6SH4yj4QdGrv3pqN6Oe 18Ecn7ELMR9q9kPBa9UWee8z/FQZXjm/ogG2J6nF1/1snsh4KFBej38kd9+/Hs9mk+yG 5DA8n/w1N5O8cBKkr0cpZbqzEe11JOurt0PXraHkOXOI5IWvu8PrTO4lp1UKGCRIHDzb Uhm/LoCgEwM+37K10singZYXl/l5IvUz5+sGz53UcOqzbX8WxRFKbPNrqDrd71Gt0ooO Rb9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ef8pahAo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056402270c00b0046c77f0b6bcsi1023860edd.562.2022.12.22.07.44.18; Thu, 22 Dec 2022 07:44:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ef8pahAo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235285AbiLVPOg (ORCPT + 67 others); Thu, 22 Dec 2022 10:14:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235335AbiLVPOV (ORCPT ); Thu, 22 Dec 2022 10:14:21 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A759424F2F; Thu, 22 Dec 2022 07:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671722060; x=1703258060; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=gyODYh2bF0u1w4lb06K7uWpgiRl7PFX7XVgYO3KlnoI=; b=Ef8pahAoZ6c2PyxVzwX8UzIgpAk1GalnhH08P5zhFRJXVVYw++2e13Lq zn7vOpzjVdRcoeJUHLohXDA1FpJB1XfTzxtDq0m7YKTmniB2hte4zqsC/ HooB0rtZbJ9tgTC+CQLkyh4AD8FaQuase9jMJRxEllwdOCoKFZp6aOQox 2F3kwutNOechoUzmcnJ5kr6vTIuHkcE+9oSWp4w7Y8VW8mIbjXN+E+Sep ORSwjCIQbq17mf4PhlInXFw0RM4Xt+1gFSgggKUy91k4LaLv/9xPzJtEo bU/KTFzj2/OKqWrfrdkrQuMdKhTxCekneeQQnP+h4ZGHv2f60916GeSvI A==; X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="300489202" X-IronPort-AV: E=Sophos;i="5.96,265,1665471600"; d="scan'208";a="300489202" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2022 07:14:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10569"; a="651806882" X-IronPort-AV: E=Sophos;i="5.96,265,1665471600"; d="scan'208";a="651806882" Received: from mylly.fi.intel.com (HELO [10.237.72.179]) ([10.237.72.179]) by orsmga002.jf.intel.com with ESMTP; 22 Dec 2022 07:14:15 -0800 Message-ID: <9c663363-49a0-da2f-508b-dbf3906b4d61@linux.intel.com> Date: Thu, 22 Dec 2022 17:14:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.5.1 Subject: Re: [PATCH v5 1/1] i2c: designware: use casting of u64 in clock multiplication to avoid overflow Content-Language: en-US To: Andy Shevchenko , Hanna Hawa Cc: wsa@kernel.org, mika.westerberg@linux.intel.com, jsd@semihalf.com, linus.walleij@linaro.org, ben-linux@fluff.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, dwmw@amazon.co.uk, benh@amazon.com, ronenk@amazon.com, talel@amazon.com, jonnyc@amazon.com, hanochu@amazon.com, farbere@amazon.com, itamark@amazon.com, lareine@amazon.com References: <20221221195900.23276-1-hhhawa@amazon.com> From: Jarkko Nikula In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/21/22 22:07, Andy Shevchenko wrote: > On Wed, Dec 21, 2022 at 07:59:00PM +0000, Hanna Hawa wrote: >> From: Lareine Khawaly >> >> In functions i2c_dw_scl_lcnt() and i2c_dw_scl_hcnt() may have overflow >> by depending on the values of the given parameters including the ic_clk. >> For example in our use case where ic_clk is larger than one million, >> multiplication of ic_clk * 4700 will result in 32 bit overflow. >> >> Add cast of u64 to the calculation to avoid multiplication overflow, and >> use the corresponding define for divide. > > Perfect, thank you! > Reviewed-by: Andy Shevchenko > Acked-by: Jarkko Nikula