From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Deepak R Varma <drv@mailo.com>
Cc: outreachy@lists.linux.dev, Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: iio: ad5933: Use div64_ul instead of do_div
Date: Sat, 29 Oct 2022 09:52:40 +0200 [thread overview]
Message-ID: <Y1zbyJPF+YUY6xIh@kroah.com> (raw)
In-Reply-To: <Y1r4EaDvEipzhaaf@ubunlion>
On Fri, Oct 28, 2022 at 02:58:49AM +0530, Deepak R Varma wrote:
> 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_div
> to avoid a possible truncation. Issue was identified using the
> coccicheck tool.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
> index f177b20f0f2d..730bb31a20d8 100644
> --- a/drivers/staging/iio/impedance-analyzer/ad5933.c
> +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
> @@ -196,7 +196,7 @@ static int ad5933_set_freq(struct ad5933_state *st,
> } dat;
>
> freqreg = (u64)freq * (u64)(1 << 27);
> - do_div(freqreg, st->mclk_hz / 4);
> + freqreg = div64_ul(freqreg, st->mclk_hz / 4);
>
> switch (reg) {
> case AD5933_REG_FREQ_START:
> --
> 2.34.1
No, this isn't ok, please read the mailing list archives for why these
changes are not going to be accepted:
https://lore.kernel.org/r/e2ec77060cc84a33b49d5fd11d7867f6@AcuMS.aculab.com
Please always at least look at the archives of the past few weeks as to
if changes like this are able to be accepted or not.
thanks,
greg k-h
next prev parent reply other threads:[~2022-10-29 7:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 21:28 [PATCH] staging: iio: ad5933: Use div64_ul instead of do_div Deepak R Varma
2022-10-28 10:11 ` Sa, Nuno
2022-10-29 11:23 ` David Laight
2022-11-04 18:47 ` Deepak R Varma
2022-10-29 7:52 ` Greg Kroah-Hartman [this message]
2022-10-31 10:06 ` Deepak R Varma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y1zbyJPF+YUY6xIh@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Michael.Hennerich@analog.com \
--cc=drv@mailo.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=outreachy@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox