Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned

The usb_dmac_get_current_residue function used to
take a signed integer as a pos parameter.
The only callers of this function passes an unsigned integer to it.
Therefore to make it obviously safe, let's just make this an unsgined
integer as this is used in pointer arithmetics.

Signed-off-by: Jordy Zomer <jordy@pwning.systems>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210731091939.510816-1-jordy@pwning.systems
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Jordy Zomer and committed by
Vinod Koul
5eea6c97 b60bb6e2

+1 -1
+1 -1
drivers/dma/sh/usb-dmac.c
··· 466 466 467 467 static unsigned int usb_dmac_get_current_residue(struct usb_dmac_chan *chan, 468 468 struct usb_dmac_desc *desc, 469 - int sg_index) 469 + unsigned int sg_index) 470 470 { 471 471 struct usb_dmac_sg *sg = desc->sg + sg_index; 472 472 u32 mem_addr = sg->mem_addr & 0xffffffff;