Skip to content

Commit 15b93f3

Browse files
xndcngregkh
authored andcommitted
usbip: Fix seqnum sign extension issue in vhci_tx_urb
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 <[email protected]> Acked-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 6d7965f commit 15b93f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/usbip/vhci_hcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ static void vhci_tx_urb(struct urb *urb, struct vhci_device *vdev)
676676

677677
spin_lock_irqsave(&vdev->priv_lock, flags);
678678

679-
priv->seqnum = atomic_inc_return(&vhci_hcd->seqnum);
679+
priv->seqnum = (u32)atomic_inc_return(&vhci_hcd->seqnum);
680680
if (priv->seqnum == 0xffff)
681681
dev_info(&urb->dev->dev, "seqnum max\n");
682682

0 commit comments

Comments
 (0)