Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Zicheng Qu <quzicheng@huawei.com>,
	lars@metafoo.de, Michael.Hennerich@analog.com,
	gregkh@linuxfoundation.org, linux-iio@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	tanghui20@huawei.com, zhangqiao22@huawei.com,
	judy.chenhui@huawei.com
Subject: Re: [PATCH] drivers/staging/iio/frequency/ad9832.c: fix division by zero in ad9832_calc_freqreg()
Date: Tue, 22 Oct 2024 21:06:02 +0100	[thread overview]
Message-ID: <20241022210602.691d6351@jic23-huawei> (raw)
In-Reply-To: <6c896172-d372-442a-a61e-6b3e46b9cbb0@stanley.mountain>

On Tue, 22 Oct 2024 17:25:21 +0300
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> It would be better if the subject prefix were "staging: iio: ad9832:"
> 
> [PATCH] staging: iio: ad9832: fix division by zero in ad9832_calc_freqreg()
Keep the frequency as well, though less important in staging as we
have only a few drivers there.

I fixed up the patch title and applied this to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

> 
> On Tue, Oct 22, 2024 at 01:43:54PM +0000, Zicheng Qu wrote:
> > In the ad9832_write_frequency() function, clk_get_rate() might return 0.
> > This can lead to a division by zero when calling ad9832_calc_freqreg().
> > The check if (fout > (clk_get_rate(st->mclk) / 2)) does not protect
> > against the case when fout is 0. The ad9832_write_frequency() function
> > is called from ad9832_write(), and fout is derived from a text buffer,
> > which can contain any value.
> > 
> > Link: https://lore.kernel.org/all/2024100904-CVE-2024-47663-9bdc@gregkh/
> > Fixes: ea707584bac1 ("Staging: IIO: DDS: AD9832 / AD9835 driver")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Zicheng Qu <quzicheng@huawei.com>  
> 
> Otherwise it looks good.
> 
> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> regards,
> dan carpenter
> 


  reply	other threads:[~2024-10-22 20:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22 13:43 [PATCH] drivers/staging/iio/frequency/ad9832.c: fix division by zero in ad9832_calc_freqreg() Zicheng Qu
2024-10-22 14:25 ` Dan Carpenter
2024-10-22 20:06   ` Jonathan Cameron [this message]
2024-10-22 14:25 ` Nuno Sá

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=20241022210602.691d6351@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=judy.chenhui@huawei.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=quzicheng@huawei.com \
    --cc=tanghui20@huawei.com \
    --cc=zhangqiao22@huawei.com \
    /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