From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EABAC433FE for ; Sat, 29 Oct 2022 11:59:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229497AbiJ2L7i (ORCPT ); Sat, 29 Oct 2022 07:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbiJ2L7h (ORCPT ); Sat, 29 Oct 2022 07:59:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FC7D1F5; Sat, 29 Oct 2022 04:59:27 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id D6FA7B80B8C; Sat, 29 Oct 2022 11:59:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA47C433C1; Sat, 29 Oct 2022 11:59:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667044764; bh=Ap5s75s7ijrFAwTqA7tudLOZWue/4KVuAcaVQy36hgw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nM6bYNlsiYigLSzaUv73E7fYpiHLuaCLaAbWt0qY3RCkZ5kYnHHkx/VOGI2sdwZeY 5TpBkB4tqt4PnENvj1UKHmF/6hYZu/AoN70xwVcdWIBe0WGmUVNU5NOo5R+vApuqNQ QDjbJ9GnvsXWfJmuw2KFjBugsrxT/8ziq1zXK7ulgkexb+nqm1pxybTPpp8zO6b320 pnuLej+/DBXnrRljKQV3TTZezWBtAg03eavfXQ6XWMvsWA8EBl69IxvGZTcSFqkQxY HbJsNtXBuupjnvCY1WcvM+B3tNYhg7Wmz9jHJtSAuVlH4Y4ahu2jFQCfE/RYz6ZvCy d8/WRHlhzf7/Q== Date: Sat, 29 Oct 2022 13:11:19 +0100 From: Jonathan Cameron To: "Sa, Nuno" Cc: Deepak R Varma , "outreachy@lists.linux.dev" , Lars-Peter Clausen , "Hennerich, Michael" , Greg Kroah-Hartman , "linux-iio@vger.kernel.org" , "linux-staging@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] staging: iio: frequency: ad9834: Use div64_ul instead of do_div Message-ID: <20221029131119.2f000985@jic23-huawei> In-Reply-To: References: X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Fri, 28 Oct 2022 10:14:48 +0000 "Sa, Nuno" wrote: > > -----Original Message----- > > From: Deepak R Varma > > Sent: Friday, October 28, 2022 12:00 AM > > To: outreachy@lists.linux.dev; Lars-Peter Clausen ; > > Hennerich, Michael ; Jonathan Cameron > > ; Greg Kroah-Hartman ; > > linux-iio@vger.kernel.org; linux-staging@lists.linux.dev; linux- > > kernel@vger.kernel.org > > Subject: [PATCH v2] staging: iio: frequency: ad9834: Use div64_ul inste= ad of > > do_div > >=20 > > [External] > >=20 > > do_div() does a 64-by-32 division. Here the divisor is an unsigned long > > which on some platforms is 64 bit wide. So use div64_ul instead of do_d= iv > > to avoid a possible truncation. Issue identified using the > > coccicheck tool. > >=20 > > Signed-off-by: Deepak R Varma > > --- =20 >=20 > Clearly, I should have looked better and only reply to this one: >=20 > Reviewed-by: Nuno S=C3=A1 As per the email Greg linked to, please take a close look at the surround c= ode and include analysis of whether the value can actually be greater than 32 b= its. Note that in most cases that would actually mean the code was broken on 32 = bit platforms.