dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned
authorJordy Zomer <jordy@pwning.systems>
Sat, 31 Jul 2021 09:19:38 +0000 (11:19 +0200)
committerVinod Koul <vkoul@kernel.org>
Mon, 2 Aug 2021 06:46:47 +0000 (12:16 +0530)
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>
drivers/dma/sh/usb-dmac.c

index 1cc06900153e4c6f763b8b35e2458869d61e53b7..5edaeb89d1e68e0009a3950f2f26bc32af0c89ee 100644 (file)
@@ -466,7 +466,7 @@ static int usb_dmac_chan_terminate_all(struct dma_chan *chan)
 
 static unsigned int usb_dmac_get_current_residue(struct usb_dmac_chan *chan,
                                                 struct usb_dmac_desc *desc,
-                                                int sg_index)
+                                                unsigned int sg_index)
 {
        struct usb_dmac_sg *sg = desc->sg + sg_index;
        u32 mem_addr = sg->mem_addr & 0xffffffff;