All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ronan Dalton" <ronan.dalton@alliedtelesis.co.nz>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (nct7802) Add time step attributes for tweaking responsiveness
Date: Wed, 13 May 2026 23:31:46 +0000	[thread overview]
Message-ID: <20260513233146.CBAC5C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260512041607.988078-2-ronan.dalton@alliedtelesis.co.nz>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] kstrtoul is called with base 0 for a time interval, allowing unintended octal parsing.
--

commit 3cecff14f185e191b2b2e66dc9e9e9cb80c25244
Author: Ronan Dalton <ronan.dalton@alliedtelesis.co.nz>

hwmon: (nct7802) Add time step attributes for tweaking responsiveness

This commit adds sysfs attributes to configure the step up and step down
time intervals for the Smart Fan mode on the nct7802 chip. The user-facing
values are specified in milliseconds and clamped to valid ranges.

> diff --git a/drivers/hwmon/nct7802.c b/drivers/hwmon/nct7802.c
> index 8c9351da12c6e..f30123fd908cd 100644
> --- a/drivers/hwmon/nct7802.c
> +++ b/drivers/hwmon/nct7802.c
[ ... ]
> +static ssize_t step_time_store(struct device *dev,
> +			       struct device_attribute *attr, const char *buf,
> +			       size_t count, bool step_up)
> +{
> +	struct nct7802_data *data = dev_get_drvdata(dev);
> +	unsigned long val;
> +	unsigned int reg;
> +	int ret;
> +
> +	ret = kstrtoul(buf, 0, &val);

Does this allow unintended octal parsing?

Using base 0 means that a zero-padded string written from a userspace script
(e.g., echo 0150 > step_up_time) will be parsed as an octal number rather
than decimal.

Should this use base 10 instead to prevent surprising behavior and match
other standard sysfs attribute parsers in this driver?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260512041607.988078-2-ronan.dalton@alliedtelesis.co.nz?part=1

  reply	other threads:[~2026-05-13 23:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12  4:15 [PATCH] hwmon: (nct7802) Add time step attributes for tweaking responsiveness Ronan Dalton
2026-05-13 23:31 ` sashiko-bot [this message]
2026-05-14  0:10   ` Guenter Roeck
2026-05-14  0:12   ` Ronan Dalton
  -- strict thread matches above, loose matches on Subject: below --
2026-05-14  0:16 Ronan Dalton
2026-05-14  0:36 ` Ronan Dalton

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=20260513233146.CBAC5C2BCB3@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=ronan.dalton@alliedtelesis.co.nz \
    --cc=sashiko-reviews@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.