Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503271 > unrolled thread

[PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type

Started byRyan Swan <ryan@ryanswan.com>
First post2016-10-18 20:10 +0200
Last post2016-10-19 17:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type Ryan Swan <ryan@ryanswan.com> - 2016-10-18 20:10 +0200
    Re: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument  type Lino Sanfilippo <LinoSanfilippo@gmx.de> - 2016-10-18 21:30 +0200
    Re: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument  type Dan Carpenter <dan.carpenter@oracle.com> - 2016-10-19 17:00 +0200

#1503271 — [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type

FromRyan Swan <ryan@ryanswan.com>
Date2016-10-18 20:10 +0200
Subject[PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type
Message-ID<stGZP-5pH-25@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1503306 — Re: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type

FromLino Sanfilippo <LinoSanfilippo@gmx.de>
Date2016-10-18 21:30 +0200
SubjectRe: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type
Message-ID<stIff-6f2-7@gated-at.bofh.it>
In reply to#1503271
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

[toc] | [prev] | [next] | [standalone]


#1503770 — Re: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-10-19 17:00 +0200
SubjectRe: [PATCH] staging: slicoss.ko: slicoss.c: Fixed incorrect argument type
Message-ID<su0vv-2D0-3@gated-at.bofh.it>
In reply to#1503271
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web