From: Ethan Tidmore <ethantidmore06@gmail.com>
To: "Derek J . Clark" <derekjohn.clark@gmail.com>,
Mark Pearson <mpearson-lenovo@squebb.ca>,
Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>,
Mario Limonciello <mario.limonciello@amd.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Ethan Tidmore <ethantidmore06@gmail.com>
Subject: [PATCH 3/3] HID: hid-lenovo-go-s: Fix positive promotion bug
Date: Fri, 27 Feb 2026 14:54:44 -0600 [thread overview]
Message-ID: <20260227205444.1083103-4-ethantidmore06@gmail.com> (raw)
In-Reply-To: <20260227205444.1083103-1-ethantidmore06@gmail.com>
The function mcu_property_out() returns type int and returns negative
error codes. The variable count is assigned from it and checked with
(count < 0) but this check would always be false because count can
never be less than zero as it is size_t.
Change count to ssize_t.
Detected by Smatch:
drivers/hid/hid-lenovo-go-s.c:583 gamepad_property_show() warn:
unsigned 'count' is never less than zero.
drivers/hid/hid-lenovo-go-s.c:583 gamepad_property_show() warn:
error code type promoted to positive: 'count'
Fixes: 14651777fd675 ("HID: hid-lenovo-go-s: Add Feature Status Attributes")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
drivers/hid/hid-lenovo-go-s.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-lenovo-go-s.c b/drivers/hid/hid-lenovo-go-s.c
index a24737170f83..4596c18037a9 100644
--- a/drivers/hid/hid-lenovo-go-s.c
+++ b/drivers/hid/hid-lenovo-go-s.c
@@ -573,7 +573,7 @@ static ssize_t gamepad_property_show(struct device *dev,
struct device_attribute *attr, char *buf,
enum feature_status_index index)
{
- size_t count = 0;
+ ssize_t count = 0;
u8 i;
count = mcu_property_out(drvdata.hdev, GET_GAMEPAD_CFG, index, 0, 0);
--
2.53.0
next prev parent reply other threads:[~2026-02-27 20:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 20:54 [PATCH 0/3] HID: hid-lenovo-go-s: Multiple bug fixes Ethan Tidmore
2026-02-27 20:54 ` [PATCH 1/3] HID: hid-lenovo-go-s: Fix signedness bug Ethan Tidmore
2026-03-06 5:57 ` Derek John Clark
2026-02-27 20:54 ` [PATCH 2/3] HID: hid-lenovo-go-s: Remove impossible condition Ethan Tidmore
2026-03-06 5:57 ` Derek John Clark
2026-02-27 20:54 ` Ethan Tidmore [this message]
2026-03-06 5:57 ` [PATCH 3/3] HID: hid-lenovo-go-s: Fix positive promotion bug Derek John Clark
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=20260227205444.1083103-4-ethantidmore06@gmail.com \
--to=ethantidmore06@gmail.com \
--cc=bentiss@kernel.org \
--cc=derekjohn.clark@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mpearson-lenovo@squebb.ca \
/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