From: Matt Jan <zoo868e@gmail.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Matt Jan <zoo868e@gmail.com>,
syzbot+d7d8c418e8317899e88c@syzkaller.appspotmail.com
Subject: [PATCH] can: ucan: Correct the size parameter
Date: Tue, 18 Feb 2025 03:04:04 +0800 [thread overview]
Message-ID: <20250217190404.354574-1-zoo868e@gmail.com> (raw)
In-Reply-To: <67b323a4.050a0220.173698.002b.GAE@google.com>
According to the comment, the size parameter is only required when
@dst is not an array, or when the copy needs to be smaller than
sizeof(@dst). Since the source is a `union ucan_ctl_payload`, the
correct size should be sizeof(union ucan_ctl_payload).
Signed-off-by: Matt Jan <zoo868e@gmail.com>
Reported-by: syzbot+d7d8c418e8317899e88c@syzkaller.appspotmail.com
Fixes: b3e40fc85735 ("USB: usb_parse_endpoint: ignore reserved bits")
---
drivers/net/can/usb/ucan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index 39a63b7313a4..1ccef00388ae 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -1533,7 +1533,7 @@ static int ucan_probe(struct usb_interface *intf,
if (ret > 0) {
/* copy string while ensuring zero termination */
strscpy(firmware_str, up->ctl_msg_buffer->raw,
- sizeof(union ucan_ctl_payload) + 1);
+ sizeof(union ucan_ctl_payload));
} else {
strcpy(firmware_str, "unknown");
}
--
2.25.1
next prev parent reply other threads:[~2025-02-17 19:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 11:55 [syzbot] [can?] WARNING in ucan_probe syzbot
2025-02-17 12:57 ` Marc Kleine-Budde
2025-02-17 19:04 ` Matt Jan [this message]
2025-02-18 2:22 ` [PATCH] can: ucan: Correct the size parameter Vincent Mailhol
2025-02-18 7:37 ` Marc Kleine-Budde
2025-02-18 14:26 ` Vincent Mailhol
2025-02-18 14:27 ` Marc Kleine-Budde
2025-02-18 14:32 ` [PATCH] can: ucan: fix out of bound read in strscpy() source Vincent Mailhol
2025-02-18 15:12 ` Marc Kleine-Budde
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=20250217190404.354574-1-zoo868e@gmail.com \
--to=zoo868e@gmail.com \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=syzbot+d7d8c418e8317899e88c@syzkaller.appspotmail.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