From: sashiko-bot@kernel.org
To: "Alexander A. Klimov" <grandmaster@al2klimov.de>
Cc: vkoul@kernel.org, Frank.Li@kernel.org, dmaengine@vger.kernel.org
Subject: Re: [PATCH] dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1
Date: Tue, 26 May 2026 06:24:16 +0000 [thread overview]
Message-ID: <20260526062417.47C311F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260526061321.6123-3-grandmaster@al2klimov.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The sysfs store function silently ignores parsing errors and incorrectly returns success (`count`) when given invalid input.
--
commit fe01246cf60369a73aac5e63b92278079b4417aa
Author: Alexander A. Klimov <grandmaster@al2klimov.de>
dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1
The commit replaces the use of sscanf() with kstrtoint() in the sysfs store
function to parse user input. It also addresses a checkpatch.pl warning
regarding the formatting string.
> diff --git a/drivers/dma/ioat/sysfs.c b/drivers/dma/ioat/sysfs.c
> index e796ddb5383f8..f59df569956ae 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)) {
> if ((intr_coalesce < 0) ||
> (intr_coalesce > IOAT_INTRDELAY_MASK))
> return -EINVAL;
[Severity: Medium]
If kstrtoint() fails to parse the input and returns a negative error code,
the condition evaluates to false and the function skips the block.
Looking at the remainder of intr_coalesce_store(), execution then jumps
directly to the end of the function:
if (!kstrtoint(page, 10, &intr_coalesce)) {
...
ioat_chan->intr_coalesce = intr_coalesce;
}
return count;
Does this silently ignore parsing errors and incorrectly indicate to userspace
that the write was successful when given invalid input?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260526061321.6123-3-grandmaster@al2klimov.de?part=1
next prev parent reply other threads:[~2026-05-26 6:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260526061321.6123-1-grandmaster@al2klimov.de>
2026-05-26 6:13 ` [PATCH] dmaengine: ioatdma: use !kstrtoint(), not sscanf()!=-1 Alexander A. Klimov
2026-05-26 6:24 ` sashiko-bot [this message]
2026-05-26 14:49 ` Dave Jiang
2026-05-26 18:06 ` Alexander A. Klimov
2026-05-28 20:06 ` Dave Jiang
[not found] ` <ef38b0e8-2b6f-4f65-bac5-177b981479ae@al2klimov.de>
2026-06-01 15:12 ` Dave Jiang
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=20260526062417.47C311F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=grandmaster@al2klimov.de \
--cc=sashiko-reviews@lists.linux.dev \
--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