linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned
@ 2021-07-31  9:19 Jordy Zomer
  2021-08-01  6:27 ` Greg Kroah-Hartman
  2021-08-02  6:46 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Jordy Zomer @ 2021-07-31  9:19 UTC (permalink / raw)
  To: dmaengine; +Cc: Greg Kroah-Hartman, Jordy Zomer, Vinod Koul, linux-kernel

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>
---
 drivers/dma/sh/usb-dmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
index 8f7ceb698226..a5e225c15730 100644
--- a/drivers/dma/sh/usb-dmac.c
+++ b/drivers/dma/sh/usb-dmac.c
@@ -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;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned
  2021-07-31  9:19 [PATCH] dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned Jordy Zomer
@ 2021-08-01  6:27 ` Greg Kroah-Hartman
  2021-08-02  6:46 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-01  6:27 UTC (permalink / raw)
  To: Jordy Zomer; +Cc: dmaengine, Vinod Koul, linux-kernel

On Sat, Jul 31, 2021 at 11:19:38AM +0200, Jordy Zomer wrote:
> 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>
> ---
>  drivers/dma/sh/usb-dmac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/sh/usb-dmac.c b/drivers/dma/sh/usb-dmac.c
> index 8f7ceb698226..a5e225c15730 100644
> --- a/drivers/dma/sh/usb-dmac.c
> +++ b/drivers/dma/sh/usb-dmac.c
> @@ -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;
> -- 
> 2.27.0
> 

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned
  2021-07-31  9:19 [PATCH] dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned Jordy Zomer
  2021-08-01  6:27 ` Greg Kroah-Hartman
@ 2021-08-02  6:46 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2021-08-02  6:46 UTC (permalink / raw)
  To: Jordy Zomer; +Cc: dmaengine, Greg Kroah-Hartman, linux-kernel

On 31-07-21, 11:19, Jordy Zomer wrote:
> 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.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-02  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-31  9:19 [PATCH] dmaengine: usb-dmac: make usb_dmac_get_current_residue unsigned Jordy Zomer
2021-08-01  6:27 ` Greg Kroah-Hartman
2021-08-02  6:46 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).