All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type
@ 2016-10-18 18:03 Ryan Swan
  2016-10-18 19:22 ` Lino Sanfilippo
  2016-10-19  8:32 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Ryan Swan @ 2016-10-18 18:03 UTC (permalink / raw)
  To: devel
  Cc: Ryan Swan, liodot, charrer, gregkh, LinoSanfilippo, bmarsh94,
	amarjargal.gundjalam, aquannie, janani.rvchndrn, kevin.m.wern,
	linux-kernel

sparse produced
warning: incorrect type in argument 2 (different address spaces)
expected void const volatile [noderef] <asn:2>*src
got struct slic_stats *stats

casting argument 2 to what is expected by memcpy_fromio() fixed this

Signed-off-by: Ryan Swan <ryan@ryanswan.com>
---
 drivers/staging/slicoss/slicoss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 2802b90..7c6feb1 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -1057,7 +1057,7 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
 		if (stats->rcv_drops > old->rcv_drops)
 			adapter->rcv_drops += (stats->rcv_drops -
 					       old->rcv_drops);
-		memcpy_fromio(old, stats, sizeof(*stats));
+		memcpy_fromio(old, (void __iomem *)stats, sizeof(*stats));
 		break;
 	}
 	case SLIC_UPR_RLSR:
-- 
2.7.4

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

* Re: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type
  2016-10-18 18:03 [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type Ryan Swan
@ 2016-10-18 19:22 ` Lino Sanfilippo
  2016-10-19  8:32 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Lino Sanfilippo @ 2016-10-18 19:22 UTC (permalink / raw)
  To: Ryan Swan, devel
  Cc: liodot, charrer, gregkh, bmarsh94, amarjargal.gundjalam,
	aquannie, janani.rvchndrn, kevin.m.wern, linux-kernel

Hi Ryan,

On 18.10.2016 20:03, Ryan Swan wrote:
> sparse produced
> warning: incorrect type in argument 2 (different address spaces)
> expected void const volatile [noderef] <asn:2>*src
> got struct slic_stats *stats
> 
> casting argument 2 to what is expected by memcpy_fromio() fixed this
> 
> Signed-off-by: Ryan Swan <ryan@ryanswan.com>
> ---
>  drivers/staging/slicoss/slicoss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> index 2802b90..7c6feb1 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -1057,7 +1057,7 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
>  		if (stats->rcv_drops > old->rcv_drops)
>  			adapter->rcv_drops += (stats->rcv_drops -
>  					       old->rcv_drops);
> -		memcpy_fromio(old, stats, sizeof(*stats));
> +		memcpy_fromio(old, (void __iomem *)stats, sizeof(*stats));
>  		break;
>  	}
>  	case SLIC_UPR_RLSR:
> 

The issue here is the use of memcpy_fromio() while it actually is not io but dma 
memory that we copy from.

Regards,
Lino

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

* Re: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type
  2016-10-18 18:03 [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type Ryan Swan
  2016-10-18 19:22 ` Lino Sanfilippo
@ 2016-10-19  8:32 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-10-19  8:32 UTC (permalink / raw)
  To: Ryan Swan, LinoSanfilippo
  Cc: devel, amarjargal.gundjalam, janani.rvchndrn, gregkh,
	linux-kernel, liodot, kevin.m.wern, LinoSanfilippo, charrer,
	aquannie

On Tue, Oct 18, 2016 at 02:03:31PM -0400, Ryan Swan wrote:
> sparse produced
> warning: incorrect type in argument 2 (different address spaces)
> expected void const volatile [noderef] <asn:2>*src
> got struct slic_stats *stats
> 
> casting argument 2 to what is expected by memcpy_fromio() fixed this
> 
> Signed-off-by: Ryan Swan <ryan@ryanswan.com>
> ---
>  drivers/staging/slicoss/slicoss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
> index 2802b90..7c6feb1 100644
> --- a/drivers/staging/slicoss/slicoss.c
> +++ b/drivers/staging/slicoss/slicoss.c
> @@ -1057,7 +1057,7 @@ static void slic_upr_request_complete(struct adapter *adapter, u32 isr)
>  		if (stats->rcv_drops > old->rcv_drops)
>  			adapter->rcv_drops += (stats->rcv_drops -
>  					       old->rcv_drops);
> -		memcpy_fromio(old, stats, sizeof(*stats));
> +		memcpy_fromio(old, (void __iomem *)stats, sizeof(*stats));

This should probably just be memcpy().  Introduced in commit fdb777751278
("staging: slicoss: improve implementation concerning the shared memory").

regards,
dan carpenter

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

end of thread, other threads:[~2016-10-19 14:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-18 18:03 [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type Ryan Swan
2016-10-18 19:22 ` Lino Sanfilippo
2016-10-19  8:32 ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.