Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6119937rwl; Mon, 9 Jan 2023 04:33:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXtZVojHHouOJ/nHsJkMq+Hn4Kf1j1dlyU2cLdWKTLuUUC+cDIv0+hBoqki0wJO051KiFsKT X-Received: by 2002:a17:907:6746:b0:836:e7de:9792 with SMTP id qm6-20020a170907674600b00836e7de9792mr41851175ejc.32.1673267629758; Mon, 09 Jan 2023 04:33:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673267629; cv=none; d=google.com; s=arc-20160816; b=RSu+gzpcdzl7KFt+MXjyHekivI3O6vZftDu/CXj3t47RA14mfn6iXkKIDeO2OyOouV Uw4bDQcoVHaQ8x+DtykDdYukMoMSFW3btvRd5hOJVDZlYZI0JTPnpy+HrIa8r9a81UVo huGCHpmKVGNyysqFY9b8Xxal8Lg0UhBbiRdLhUqzdhdWRFkS326X9bPxx8rLXzwdtGTm hEqaoTTF2P2x74E8HkOCGsD3qehHQDfq2PivxKAbvkDquKHxPBQXzvJiY8t6+E5GClH5 Dp8gzLRa4iMrjicpXWmKU3LsBljliuZkI9pTxy9yWJRFIOD7r15aW9k4jQCiGpkLOYuu iTZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4xCS8SMRbYF0izXOPugXxXKb6TJYQmzcsXzJyntgByo=; b=CmmHuEXj4WJp4sdCW+t+SDP4xreWB6FHs6z0WeT6osO6PvSLwwvEsWiZ+wOP8xbFls zXRW+tmfadpinf/SmNvhaHVNnMChJawEaK5r40Pq/UbKWq6JqVOq1baijYqFkAkLGrD2 PRL+veRg5eOiOBLZM8La/iz4YjtIEHFk5HVFp7C4Rj75nNvKLKDqUtjAh2s7HisRm4X2 usrV0ZCszT0Ztimn1Zhg7AEcfz71oCrFezoYbcxidP14iU190bhiX1N4hBG53IV8lFMH O8HD7Yhq2C+yN6U1vO86ls9lp+sMJskTT2UH1uytpvabpau9cekuNRcGpCuXUIHnbkHR 1xIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bh0Qh8Np; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa14-20020a170907868e00b007b790c183e0si10805156ejc.290.2023.01.09.04.33.36; Mon, 09 Jan 2023 04:33:49 -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=@kernel.org header.s=k20201202 header.b=Bh0Qh8Np; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237112AbjAIMIE (ORCPT + 53 others); Mon, 9 Jan 2023 07:08:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237110AbjAIMHy (ORCPT ); Mon, 9 Jan 2023 07:07:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A25A1A3A8; Mon, 9 Jan 2023 04:07:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26EFD6102F; Mon, 9 Jan 2023 12:07:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 356F3C433F0; Mon, 9 Jan 2023 12:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673266072; bh=4xCS8SMRbYF0izXOPugXxXKb6TJYQmzcsXzJyntgByo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Bh0Qh8NpeUnJm0zRetSOuHzoqhoR48DeCN1hIDL1yANI9LnhypvBgJeovffWy+ZfJ EJymDz+UQyyhsULKjOOxbwL4Nzvq4mSgR7mybHFgsmpMAr2GFTuI92ysvsQt/orVFL Ea0IQPqIefdle8VdO/sOSJyBQ4Y9+mvSmL/R3VHxM3jWqzT368WVL4kADXHX9uQ4x5 xYNjHUz83H3/Q0X0Q1q6sMMcz+bWd4PkKw2Nk2Qd5C3+pHTjKQB/XdQyiXtdHvo4Ss sxTAw6rXiCl6aPlnIQWEsYb1ZsmpZVb2RfOCFB2HmdW8i4Amhkdeb8hCHC1KZHsnEl LFG4FUTk1LWbg== Date: Mon, 9 Jan 2023 13:07:49 +0100 From: Wolfram Sang To: Hanna Hawa Cc: jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, 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 Subject: Re: [PATCH v5 1/1] i2c: designware: use casting of u64 in clock multiplication to avoid overflow Message-ID: Mail-Followup-To: Wolfram Sang , Hanna Hawa , jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com, 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wdw+qpb2+KvBw02n" Content-Disposition: inline In-Reply-To: <20221221195900.23276-1-hhhawa@amazon.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 --wdw+qpb2+KvBw02n Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 21, 2022 at 07:59:00PM +0000, Hanna Hawa wrote: > From: Lareine Khawaly >=20 > 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. >=20 > Add cast of u64 to the calculation to avoid multiplication overflow, and > use the corresponding define for divide. >=20 > Fixes: 2373f6b9744d ("i2c-designware: split of i2c-designware.c into core= and bus specific parts") > Signed-off-by: Lareine Khawaly > Signed-off-by: Hanna Hawa Applied to for-current, thanks! --wdw+qpb2+KvBw02n Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmO8A5UACgkQFA3kzBSg KbZHyA//epQ1hwTlx9ELobS2Ytyu3/pQdlzz7w+RhyMK34KnoMJzC/DGte5oreqI x5VPqeFJ3qQy+Qr/yKrTXzA6ag5zAb8t1iFqWmpPYAj4EHRsGdc4qlwr7bax/xOF vxJ27Pu5TMEiNQCy4jpYCMMGF9IWPnfMZdDiK2Xl86OKhLAgHBTdLViu5ARCjFSR LNGHXOXuyjSx6+FfaVnjta5VJoyTrSX/HojLotfXBQ5HmkFTUEC1Z+Go5by2+3jt nXWwZnzrk1oQvJ/UBkca1gLLQHxliDWtCnm6L+8Mwg+59yJo3anAulf0Vf5zVqIG HcBWjxie9lHEhRCEdOkTy8e63c/6AYL7b4VERcxmmSkw7qnYKT4NrbaSpRVqbbiN I4diroaLoEqmE5a5+YmIgvjgpcGVCQJrnOLoG9yWZTHUmqef5/XSiob40+RCRqLH 5jAnl7jBRjF820BkMkbZ5tHgYneI8ygNHgK6KWOH+75KiYe4tixrxl8SMylSij9B fIVAF/61FM44fEespPXpH4gLLLhpC3rVQkBrTt2yyY8kjmUVIgV+qQyGGrcRILET 6UOo6f0wbmr3Irpu8dut4Mcz66HOzVmitq9MBHlZqpcfjDidJkKPSobr1KoyITK6 F8X1nxSoGeMTrPlPvQOmjhr3CUX1ZX1yLmQ0iYLY05ihI2FAu+E= =Ka1V -----END PGP SIGNATURE----- --wdw+qpb2+KvBw02n--