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


Groups > linux.kernel > #1360813 > unrolled thread

[PATCH] ntb: test: fix pointer size warning

Started byBrian Norris <computersforpeace@gmail.com>
First post2016-03-18 18:20 +0100
Last post2016-03-27 17:30 +0200
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ntb: test: fix pointer size warning Brian Norris <computersforpeace@gmail.com> - 2016-03-18 18:20 +0100
    Re: [PATCH] ntb: test: fix pointer size warning "Jiang, Dave" <dave.jiang@intel.com> - 2016-03-18 18:20 +0100
    Re: [PATCH] ntb: test: fix pointer size warning Jon Mason <jdmason@kudzu.us> - 2016-03-22 01:00 +0100
      Re: [PATCH] ntb: test: fix pointer size warning Brian Norris <computersforpeace@gmail.com> - 2016-03-22 01:40 +0100
        Re: [PATCH] ntb: test: fix pointer size warning Jon Mason <jdmason@kudzu.us> - 2016-03-27 17:30 +0200

#1360813 — [PATCH] ntb: test: fix pointer size warning

FromBrian Norris <computersforpeace@gmail.com>
Date2016-03-18 18:20 +0100
Subject[PATCH] ntb: test: fix pointer size warning
Message-ID<re6e6-2TF-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1360814

From"Jiang, Dave" <dave.jiang@intel.com>
Date2016-03-18 18:20 +0100
Message-ID<re6e6-2TF-17@gated-at.bofh.it>
In reply to#1360813
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);

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


#1362228

FromJon Mason <jdmason@kudzu.us>
Date2016-03-22 01:00 +0100
Message-ID<rfhTP-4r5-7@gated-at.bofh.it>
In reply to#1360813
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
> 

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


#1362245

FromBrian Norris <computersforpeace@gmail.com>
Date2016-03-22 01:40 +0100
Message-ID<rfiwy-4XQ-9@gated-at.bofh.it>
In reply to#1362228
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

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


#1365122

FromJon Mason <jdmason@kudzu.us>
Date2016-03-27 17:30 +0200
Message-ID<rhkNA-1SE-7@gated-at.bofh.it>
In reply to#1362245
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web