From: Dave Jiang <dave.jiang@intel.com>
To: "Alexander A. Klimov" <grandmaster@al2klimov.de>,
"Vinod Koul" <vkoul@kernel.org>, "Frank Li" <Frank.Li@kernel.org>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Ujjal Singh" <ujjal.singh@intel.com>,
"open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM"
<dmaengine@vger.kernel.org>,
"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1
Date: Tue, 26 May 2026 07:49:10 -0700 [thread overview]
Message-ID: <9461e4b3-d42b-4550-a931-19532588bdbc@intel.com> (raw)
In-Reply-To: <20260526061321.6123-3-grandmaster@al2klimov.de>
On 5/25/26 11:13 PM, Alexander A. Klimov wrote:
> Depending on the user input, sscanf() may return 0 for 0 success.
> But intr_coalesce_store() wants sscanf() to parse one number,
> so expect 1 from sscanf(), not any int except -1.
>
> While on it, fix typo in %du by using just %d,
> as this interface expects %d or %d\n.
> Latter made scripts/checkpatch.pl complain,
> so use kstrtoint() instead of sscanf().
>
> Fixes: 268e2519f5b7 ("dmaengine: ioatdma: Add intr_coalesce sysfs entry")
> Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
> ---
> drivers/dma/ioat/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index e796ddb5383f..f59df569956a 100644
> --- a/drivers/dma/ioat/sysfs.c
> +++ b/drivers/dma/ioat/sysfs.c
> @@ -144,7 +144,7 @@ size_t count)
> int intr_coalesce = 0;
> struct ioatdma_chan *ioat_chan = to_ioat_chan(c);
>
> - if (sscanf(page, "%du", &intr_coalesce) != -1) {
> + if (!kstrtoint(page, 10, &intr_coalesce)) {
looks good. We can probably use kstrtouint() since we are expecting a positive number always.
DJ
> if ((intr_coalesce < 0) ||
> (intr_coalesce > IOAT_INTRDELAY_MASK))
> return -EINVAL;
next prev parent reply other threads:[~2026-05-26 14:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 6:13 [PATCH] clk: samsung: exynos5410: fix refcount leak Alexander A. Klimov
2026-05-26 6:13 ` [PATCH] clk: tegra: tegra124-emc: fix krealloc() memory leak Alexander A. Klimov
2026-05-26 17:33 ` Brian Masney
2026-05-28 20:30 ` Thierry Reding
2026-05-31 19:52 ` [PATCH v2] " Alexander A. Klimov
2026-07-30 15:55 ` Thierry Reding
2026-05-26 6:13 ` [PATCH] dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1 Alexander A. Klimov
2026-05-26 14:49 ` Dave Jiang [this message]
2026-05-26 18:06 ` Alexander A. Klimov
2026-05-28 20:06 ` Dave Jiang
2026-05-31 8:56 ` Alexander A. Klimov
2026-06-01 15:12 ` Dave Jiang
2026-05-26 6:13 ` [PATCH] tlclk: if sscanf() fails, fall back to 0, not random value Alexander A. Klimov
2026-05-26 17:29 ` [PATCH] clk: samsung: exynos5410: fix refcount leak Brian Masney
2026-05-28 1:15 ` Alexey Klimov
2026-05-28 8:02 ` Peter Griffin
2026-05-30 16:26 ` Krzysztof Kozlowski
2026-05-31 9:27 ` Alexander A. Klimov
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=9461e4b3-d42b-4550-a931-19532588bdbc@intel.com \
--to=dave.jiang@intel.com \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=grandmaster@al2klimov.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=ujjal.singh@intel.com \
--cc=vkoul@kernel.org \
/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
all inboxes | Powered by JetHome®