From: Serhat Kumral <serhatkumral1@gmail.com>
To: israel.a.cepeda.lopez@intel.com, hansg@kernel.org,
gregkh@linuxfoundation.org
Cc: sakari.ailus@linux.intel.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org,
Serhat Kumral <serhatkumral1@gmail.com>
Subject: [PATCH] usb: misc: usbio: Handle negative error code from usb_control_msg()
Date: Sat, 3 Oct 2026 17:28:38 +0300 [thread overview]
Message-ID: <20261003142838.19019-1-serhatkumral1@gmail.com> (raw)
The sizeof(*cpkt) is unsigned, so comparing "ret < sizeof(*cpkt)" promotes
"ret" to unsigned and negative error codes from usb_control_msg() are
not caught. Cast the sizeof to int so the error handling works.
Fixes: 121a0f839dbb ("usb: misc: Add Intel USBIO bridge driver")
Assisted-by: LLM
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
found by smatch:
- drivers/usb/misc/usbio.c:187 usbio_ctrl_msg() warn: error code type promoted to positive: 'ret'
drivers/usb/misc/usbio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usbio.c b/drivers/usb/misc/usbio.c
index fe093e7760d5..3f73f7c3d68a 100644
--- a/drivers/usb/misc/usbio.c
+++ b/drivers/usb/misc/usbio.c
@@ -184,7 +184,7 @@ static int usbio_ctrl_msg(struct usbio_device *usbio, u8 type, u8 cmd,
dev_dbg(usbio->dev, "control in %d hdr %*phN data %*phN\n", ret,
(int)sizeof(*cpkt), cpkt, (int)cpkt->len, cpkt->data);
- if (ret < sizeof(*cpkt)) {
+ if (ret < (int)sizeof(*cpkt)) {
dev_err(usbio->dev, "USB control in failed: %d\n", ret);
return (ret < 0) ? ret : -EPROTO;
}
--
2.53.0
next reply other threads:[~2026-10-03 14:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 14:28 Serhat Kumral [this message]
2026-10-03 15:13 ` Greg KH
2026-10-03 16:18 ` Serhat Kumral
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=20261003142838.19019-1-serhatkumral1@gmail.com \
--to=serhatkumral1@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=israel.a.cepeda.lopez@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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®