From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH RESEND] hwmon: (corsair-psu) Fix linear11 calculation
Date: Mon, 03 Aug 2026 23:34:12 +0000 [thread overview]
Message-ID: <20260803233413.5493D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803232156.2340048-1-linux@roeck-us.net>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver lacks synchronization for the shared `priv->cmd_buffer` and `wait_completion` when accessed concurrently via debugfs and sysfs, violating subsystem guidelines.
--
--- Patch [1]: [PATCH RESEND] hwmon: (corsair-psu) Fix linear11 calculation ---
(Note: The format of this report is altered to a free-form summary without inline diff quoting due to recitation restrictions.)
commit 1b6cfe916e69e567bfe7403168ee73ecb94923c7
Author: Guenter Roeck <linux@roeck-us.net>
hwmon: (corsair-psu) Fix linear11 calculation
This commit fixes the parsing of negative temperatures in Linear11 format by
correctly casting the shifted mantissa to s16. It also avoids undefined
behavior by replacing bitwise shifts on negative values with multiplication and
division, and clamps the final output to prevent underflow and overflow.
[Severity: High]
This is a pre-existing issue, but does the driver lack synchronization for the
shared priv->cmd_buffer and wait_completion primitives when accessed
concurrently?
Looking at corsairpsu_usb_cmd() in drivers/hwmon/corsair-psu.c, the shared
command buffer and completion structure are modified and sent without mutual
exclusion. Meanwhile, corsairpsu_debugfs_init() creates debugfs attributes
(such as "uptime") that bypass the hwmon core lock.
If a user or monitoring tool reads these debugfs attributes concurrently with
standard sysfs hwmon attributes, could this trigger a data race on the HID
command buffer, causing corrupted commands to be sent to the device?
Since the subsystem guidelines mandate that drivers must implement their own
locking (e.g., hwmon_lock/hwmon_unlock) for attributes registered outside the
hwmon core, and given that wrong configurations can potentially cause the PSU
to shut down, should a lock be added to protect these shared HID structures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803232156.2340048-1-linux@roeck-us.net?part=1
next prev parent reply other threads:[~2026-08-03 23:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 23:21 [PATCH RESEND] hwmon: (corsair-psu) Fix linear11 calculation Guenter Roeck
2026-08-03 23:34 ` sashiko-bot [this message]
2026-08-04 0:15 ` Ali Ahmet Memis
2026-08-04 2:58 ` Guenter Roeck
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=20260803233413.5493D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--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.