From: Xiong Nandi <xndchn@gmail.com>
To: Valentina Manea <valentina.manea.m@gmail.com>,
Shuah Khan <shuah@kernel.org>, Hongren Zheng <i@zenithal.me>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Xiong Nandi <xndchn@gmail.com>,
linux-usb@vger.kernel.org (open list:USB OVER IP DRIVER),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 1/2] usbip: Fix seqnum sign extension issue in vhci_tx_urb
Date: Wed, 1 Jan 2025 00:15:37 +0800 [thread overview]
Message-ID: <20241231161539.20192-2-xndchn@gmail.com> (raw)
In-Reply-To: <20241231161539.20192-1-xndchn@gmail.com>
The atomic_inc_return function returns an int, while priv->seqnum is an
unsigned long. So we must cast the result to u32 to prevent potential
sign extension and size mismatch issues.
Signed-off-by: Xiong Nandi <xndchn@gmail.com>
---
drivers/usb/usbip/vhci_hcd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index b03e5021c25b..f3f260e01791 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -675,7 +675,7 @@ static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev)
spin_lock_irqsave(&vdev->priv_lock, flags);
- priv->seqnum = atomic_inc_return(&vhci_hcd->seqnum);
+ priv->seqnum = (u32)atomic_inc_return(&vhci_hcd->seqnum);
if (priv->seqnum == 0xffff)
dev_info(&urb->dev->dev, "seqnum max\n");
--
2.25.1
next prev parent reply other threads:[~2024-12-31 16:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-31 16:15 [PATCH 0/2] usbip: Fix seqnum sign extension and format specifier issues Xiong Nandi
2024-12-31 16:15 ` Xiong Nandi [this message]
2025-01-02 22:06 ` [PATCH 1/2] usbip: Fix seqnum sign extension issue in vhci_tx_urb Shuah Khan
2025-01-03 15:18 ` xndcn
2025-01-09 16:02 ` Shuah Khan
2025-01-13 13:29 ` xndcn
2025-01-15 21:14 ` Shuah Khan
2024-12-31 16:15 ` [PATCH 2/2] usbip: Correct format specifier for seqnum from %d to %u Xiong Nandi
2025-01-02 22:09 ` Shuah Khan
2025-01-03 15:25 ` xndcn
2025-01-15 21:14 ` Shuah Khan
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=20241231161539.20192-2-xndchn@gmail.com \
--to=xndchn@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=i@zenithal.me \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=valentina.manea.m@gmail.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