All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ntb: test: fix pointer size warning
@ 2016-03-18 17:11 ` Brian Norris
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2016-03-18 17:11 UTC (permalink / raw)
  To: Allen Hubbe, Dave Jiang; +Cc: linux-ntb, Brian Norris, linux-kernel, Jon Mason

drivers/ntb/test/ntb_perf.c: In function ‘perf_copy’:
drivers/ntb/test/ntb_perf.c:213:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/ntb/test/ntb_perf.c:214:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

On 32-bit systems, we are casting a 32-bit pointer to a 64-bit value.
This shouldn't cause functional problems, but we might as well fix the
warning and allow 32-bit arithmetic for 32-bit systems.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Allen Hubbe <Allen.Hubbe@emc.com>
---
 drivers/ntb/test/ntb_perf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index c8a37ba4b4f9..835e2686998d 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -189,7 +189,7 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
 	dma_cookie_t cookie;
 	size_t src_off, dst_off;
 	struct perf_mw *mw = &perf->mw;
-	u64 vbase, dst_vaddr;
+	uintptr_t vbase, dst_vaddr;
 	dma_addr_t dst_phys;
 	int retries = 0;
 
@@ -210,8 +210,8 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
 	if (!is_dma_copy_aligned(device, src_off, dst_off, size))
 		return -ENODEV;
 
-	vbase = (u64)(u64 *)mw->vbase;
-	dst_vaddr = (u64)(u64 *)dst;
+	vbase = (uintptr_t)(u64 *)mw->vbase;
+	dst_vaddr = (uintptr_t)(u64 *)dst;
 	dst_phys = mw->phys_addr + (dst_vaddr - vbase);
 
 	unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOWAIT);
-- 
2.8.0.rc3.226.g39d4020

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

* [PATCH] ntb: test: fix pointer size warning
@ 2016-03-18 17:11 ` Brian Norris
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2016-03-18 17:11 UTC (permalink / raw)
  To: Allen Hubbe, Dave Jiang; +Cc: linux-ntb, Brian Norris, linux-kernel, Jon Mason

drivers/ntb/test/ntb_perf.c: In function ‘perf_copy’:
drivers/ntb/test/ntb_perf.c:213:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
drivers/ntb/test/ntb_perf.c:214:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

On 32-bit systems, we are casting a 32-bit pointer to a 64-bit value.
This shouldn't cause functional problems, but we might as well fix the
warning and allow 32-bit arithmetic for 32-bit systems.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Allen Hubbe <Allen.Hubbe@emc.com>
---
 drivers/ntb/test/ntb_perf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
index c8a37ba4b4f9..835e2686998d 100644
--- a/drivers/ntb/test/ntb_perf.c
+++ b/drivers/ntb/test/ntb_perf.c
@@ -189,7 +189,7 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
 	dma_cookie_t cookie;
 	size_t src_off, dst_off;
 	struct perf_mw *mw = &perf->mw;
-	u64 vbase, dst_vaddr;
+	uintptr_t vbase, dst_vaddr;
 	dma_addr_t dst_phys;
 	int retries = 0;
 
@@ -210,8 +210,8 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
 	if (!is_dma_copy_aligned(device, src_off, dst_off, size))
 		return -ENODEV;
 
-	vbase = (u64)(u64 *)mw->vbase;
-	dst_vaddr = (u64)(u64 *)dst;
+	vbase = (uintptr_t)(u64 *)mw->vbase;
+	dst_vaddr = (uintptr_t)(u64 *)dst;
 	dst_phys = mw->phys_addr + (dst_vaddr - vbase);
 
 	unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOWAIT);
-- 
2.8.0.rc3.226.g39d4020


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

* Re: [PATCH] ntb: test: fix pointer size warning
  2016-03-18 17:11 ` Brian Norris
  (?)
@ 2016-03-18 17:14 ` Jiang, Dave
  -1 siblings, 0 replies; 6+ messages in thread
From: Jiang, Dave @ 2016-03-18 17:14 UTC (permalink / raw)
  To: Allen.Hubbe, computersforpeace; +Cc: linux-kernel, jdmason, linux-ntb

On Fri, 2016-03-18 at 10:11 -0700, Brian Norris wrote:
> drivers/ntb/test/ntb_perf.c: In function ‘perf_copy’:
> drivers/ntb/test/ntb_perf.c:213:10: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
> drivers/ntb/test/ntb_perf.c:214:14: warning: cast from pointer to
> integer of different size [-Wpointer-to-int-cast]
> 
> On 32-bit systems, we are casting a 32-bit pointer to a 64-bit value.
> This shouldn't cause functional problems, but we might as well fix
> the
> warning and allow 32-bit arithmetic for 32-bit systems.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Jon Mason <jdmason@kudzu.us>
> Cc: Allen Hubbe <Allen.Hubbe@emc.com>

Acked-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  drivers/ntb/test/ntb_perf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/test/ntb_perf.c
> b/drivers/ntb/test/ntb_perf.c
> index c8a37ba4b4f9..835e2686998d 100644
> --- a/drivers/ntb/test/ntb_perf.c
> +++ b/drivers/ntb/test/ntb_perf.c
> @@ -189,7 +189,7 @@ static ssize_t perf_copy(struct pthr_ctx *pctx,
> char *dst,
>  	dma_cookie_t cookie;
>  	size_t src_off, dst_off;
>  	struct perf_mw *mw = &perf->mw;
> -	u64 vbase, dst_vaddr;
> +	uintptr_t vbase, dst_vaddr;
>  	dma_addr_t dst_phys;
>  	int retries = 0;
>  
> @@ -210,8 +210,8 @@ static ssize_t perf_copy(struct pthr_ctx *pctx,
> char *dst,
>  	if (!is_dma_copy_aligned(device, src_off, dst_off, size))
>  		return -ENODEV;
>  
> -	vbase = (u64)(u64 *)mw->vbase;
> -	dst_vaddr = (u64)(u64 *)dst;
> +	vbase = (uintptr_t)(u64 *)mw->vbase;
> +	dst_vaddr = (uintptr_t)(u64 *)dst;
>  	dst_phys = mw->phys_addr + (dst_vaddr - vbase);
>  
>  	unmap = dmaengine_get_unmap_data(device->dev, 1,
> GFP_NOWAIT);

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

* Re: [PATCH] ntb: test: fix pointer size warning
  2016-03-18 17:11 ` Brian Norris
  (?)
  (?)
@ 2016-03-21 23:52 ` Jon Mason
  2016-03-22  0:31   ` Brian Norris
  -1 siblings, 1 reply; 6+ messages in thread
From: Jon Mason @ 2016-03-21 23:52 UTC (permalink / raw)
  To: Brian Norris; +Cc: Allen Hubbe, Dave Jiang, linux-ntb, linux-kernel

On Fri, Mar 18, 2016 at 10:11:20AM -0700, Brian Norris wrote:
> drivers/ntb/test/ntb_perf.c: In function ‘perf_copy’:
> drivers/ntb/test/ntb_perf.c:213:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> drivers/ntb/test/ntb_perf.c:214:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> On 32-bit systems, we are casting a 32-bit pointer to a 64-bit value.
> This shouldn't cause functional problems, but we might as well fix the
> warning and allow 32-bit arithmetic for 32-bit systems.

This was already addressed by a patch from Arnd Bergmann, which is
queued in the ntb git tree.

Thanks,
Jon

> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Jon Mason <jdmason@kudzu.us>
> Cc: Allen Hubbe <Allen.Hubbe@emc.com>
> ---
>  drivers/ntb/test/ntb_perf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c
> index c8a37ba4b4f9..835e2686998d 100644
> --- a/drivers/ntb/test/ntb_perf.c
> +++ b/drivers/ntb/test/ntb_perf.c
> @@ -189,7 +189,7 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
>  	dma_cookie_t cookie;
>  	size_t src_off, dst_off;
>  	struct perf_mw *mw = &perf->mw;
> -	u64 vbase, dst_vaddr;
> +	uintptr_t vbase, dst_vaddr;
>  	dma_addr_t dst_phys;
>  	int retries = 0;
>  
> @@ -210,8 +210,8 @@ static ssize_t perf_copy(struct pthr_ctx *pctx, char *dst,
>  	if (!is_dma_copy_aligned(device, src_off, dst_off, size))
>  		return -ENODEV;
>  
> -	vbase = (u64)(u64 *)mw->vbase;
> -	dst_vaddr = (u64)(u64 *)dst;
> +	vbase = (uintptr_t)(u64 *)mw->vbase;
> +	dst_vaddr = (uintptr_t)(u64 *)dst;
>  	dst_phys = mw->phys_addr + (dst_vaddr - vbase);
>  
>  	unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOWAIT);
> -- 
> 2.8.0.rc3.226.g39d4020
> 

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

* Re: [PATCH] ntb: test: fix pointer size warning
  2016-03-21 23:52 ` Jon Mason
@ 2016-03-22  0:31   ` Brian Norris
  2016-03-27 15:23     ` Jon Mason
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2016-03-22  0:31 UTC (permalink / raw)
  To: Jon Mason; +Cc: Allen Hubbe, Dave Jiang, linux-ntb, linux-kernel

On Mon, Mar 21, 2016 at 07:52:38PM -0400, Jon Mason wrote:
> On Fri, Mar 18, 2016 at 10:11:20AM -0700, Brian Norris wrote:
> > drivers/ntb/test/ntb_perf.c: In function ‘perf_copy’:
> > drivers/ntb/test/ntb_perf.c:213:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > drivers/ntb/test/ntb_perf.c:214:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> > 
> > On 32-bit systems, we are casting a 32-bit pointer to a 64-bit value.
> > This shouldn't cause functional problems, but we might as well fix the
> > warning and allow 32-bit arithmetic for 32-bit systems.
> 
> This was already addressed by a patch from Arnd Bergmann, which is
> queued in the ntb git tree.

Great!

Is your ntb tree in linux-next.git?

Regards,
Brian

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

* Re: [PATCH] ntb: test: fix pointer size warning
  2016-03-22  0:31   ` Brian Norris
@ 2016-03-27 15:23     ` Jon Mason
  0 siblings, 0 replies; 6+ messages in thread
From: Jon Mason @ 2016-03-27 15:23 UTC (permalink / raw)
  To: Brian Norris; +Cc: Allen Hubbe, Dave Jiang, linux-ntb, linux-kernel

On Mon, Mar 21, 2016 at 8:31 PM, Brian Norris
<computersforpeace@gmail.com> wrote:
> On Mon, Mar 21, 2016 at 07:52:38PM -0400, Jon Mason wrote:
>> On Fri, Mar 18, 2016 at 10:11:20AM -0700, Brian Norris wrote:
>> > drivers/ntb/test/ntb_perf.c: In function ‘perf_copy’:
>> > drivers/ntb/test/ntb_perf.c:213:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>> > drivers/ntb/test/ntb_perf.c:214:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
>> >
>> > On 32-bit systems, we are casting a 32-bit pointer to a 64-bit value.
>> > This shouldn't cause functional problems, but we might as well fix the
>> > warning and allow 32-bit arithmetic for 32-bit systems.
>>
>> This was already addressed by a patch from Arnd Bergmann, which is
>> queued in the ntb git tree.
>
> Great!
>
> Is your ntb tree in linux-next.git?

No, it is not.

> Regards,
> Brian

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

end of thread, other threads:[~2016-03-27 15:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18 17:11 [PATCH] ntb: test: fix pointer size warning Brian Norris
2016-03-18 17:11 ` Brian Norris
2016-03-18 17:14 ` Jiang, Dave
2016-03-21 23:52 ` Jon Mason
2016-03-22  0:31   ` Brian Norris
2016-03-27 15:23     ` Jon Mason

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.