Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1350695 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-03-05 01:10 +0100 |
| Last post | 2016-03-07 15:20 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] cxgbit: fix dma_addr_t printk format Arnd Bergmann <arnd@arndb.de> - 2016-03-05 01:10 +0100
Re: [PATCH] cxgbit: fix dma_addr_t printk format Joe Perches <joe@perches.com> - 2016-03-05 01:30 +0100
Re: [PATCH] cxgbit: fix dma_addr_t printk format Arnd Bergmann <arnd@arndb.de> - 2016-03-05 01:40 +0100
Re: [PATCH] cxgbit: fix dma_addr_t printk format Joe Perches <joe@perches.com> - 2016-03-05 03:30 +0100
Re: [PATCH] cxgbit: fix dma_addr_t printk format Varun Prakash <varun@chelsio.com> - 2016-03-07 15:20 +0100
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-03-05 01:10 +0100 |
| Subject | [PATCH] cxgbit: fix dma_addr_t printk format |
| Message-ID | <r97Xc-6lT-7@gated-at.bofh.it> |
The newly added driver prints a dma_addr_t using the %llx format string,
but that is wrong on most 32-bit architectures:
drivers/target/iscsi/cxgbit/cxgbit_ddp.c: In function 'cxgbit_dump_sgl':
drivers/target/iscsi/cxgbit/cxgbit_ddp.c:180:10: error: format '%llx' expects argument of type 'long long unsigned int', but argument 8 has type 'dma_addr_t {aka unsigned int}' [-Werror=format=]
pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
Unfortunately, we can't use the %pad format string here because
we are not printing an lvalue, so we have to add a cast to u64, which
matches the format string on all architectures.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: c49aa56e556d ("cxgbit: add cxgbit_ddp.c")
---
drivers/target/iscsi/cxgbit/cxgbit_ddp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
index 07e2bc86d0df..d667bc88e21d 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
@@ -179,7 +179,7 @@ cxgbit_dump_sgl(const char *cap, struct scatterlist *sgl, int nents)
for_each_sg(sgl, sg, nents, i)
pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
i, nents, sg, sg->length, sg->offset, sg_page(sg),
- sg_dma_address(sg), sg_dma_len(sg));
+ (u64)sg_dma_address(sg), sg_dma_len(sg));
}
static int cxgbit_ddp_sgl_check(struct scatterlist *sgl, int nents)
--
2.7.0
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-03-05 01:30 +0100 |
| Message-ID | <r98gy-6uA-11@gated-at.bofh.it> |
| In reply to | #1350695 |
On Sat, 2016-03-05 at 01:04 +0100, Arnd Bergmann wrote:
> The newly added driver prints a dma_addr_t using the %llx format string,
> but that is wrong on most 32-bit architectures:
>
> drivers/target/iscsi/cxgbit/cxgbit_ddp.c: In function 'cxgbit_dump_sgl':
> drivers/target/iscsi/cxgbit/cxgbit_ddp.c:180:10: error: format '%llx' expects argument of type 'long long unsigned int', but argument 8 has type 'dma_addr_t {aka unsigned int}' [-Werror=format=]
> pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
>
> Unfortunately, we can't use the %pad format string here because
> we are not printing an lvalue, so we have to add a cast to u64, which
> matches the format string on all architectures.
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: c49aa56e556d ("cxgbit: add cxgbit_ddp.c")
> ---
> drivers/target/iscsi/cxgbit/cxgbit_ddp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> index 07e2bc86d0df..d667bc88e21d 100644
> --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> @@ -179,7 +179,7 @@ cxgbit_dump_sgl(const char *cap, struct scatterlist *sgl, int nents)
> for_each_sg(sgl, sg, nents, i)
> pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
> i, nents, sg, sg->length, sg->offset, sg_page(sg),
> - sg_dma_address(sg), sg_dma_len(sg));
> + (u64)sg_dma_address(sg), sg_dma_len(sg));
> }
>
> static int cxgbit_ddp_sgl_check(struct scatterlist *sgl, int nents)
You could create a temporary:
for_each_sg(sgl, sg, nents, i) {
dma_addr_t addr = sg_dma_address(sg);
pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma %pad, %u\n",
i, nents, sg, sg->length, sg->offset, sg_page(sg),
&addr, sg_dma_len(sg));
}
>
[toc] | [prev] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-03-05 01:40 +0100 |
| Message-ID | <r98qd-6y8-5@gated-at.bofh.it> |
| In reply to | #1350702 |
On Friday 04 March 2016 16:25:07 Joe Perches wrote:
> >
> > diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> > index 07e2bc86d0df..d667bc88e21d 100644
> > --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> > +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> > @@ -179,7 +179,7 @@ cxgbit_dump_sgl(const char *cap, struct scatterlist *sgl, int nents)
> > for_each_sg(sgl, sg, nents, i)
> > pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
> > i, nents, sg, sg->length, sg->offset, sg_page(sg),
> > - sg_dma_address(sg), sg_dma_len(sg));
> > + (u64)sg_dma_address(sg), sg_dma_len(sg));
> > }
> >
> > static int cxgbit_ddp_sgl_check(struct scatterlist *sgl, int nents)
>
> You could create a temporary:
>
> for_each_sg(sgl, sg, nents, i) {
> dma_addr_t addr = sg_dma_address(sg);
>
> pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma %pad, %u\n",
> i, nents, sg, sg->length, sg->offset, sg_page(sg),
> &addr, sg_dma_len(sg));
> }
>
Sure, but the cast seemed nicer in this case, the result is the same.
Arnd
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2016-03-05 03:30 +0100 |
| Message-ID | <r9a8G-7P5-9@gated-at.bofh.it> |
| In reply to | #1350710 |
On Sat, 2016-03-05 at 01:34 +0100, Arnd Bergmann wrote:
> On Friday 04 March 2016 16:25:07 Joe Perches wrote:
> > > diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
[]
> > > @@ -179,7 +179,7 @@ cxgbit_dump_sgl(const char *cap, struct scatterlist *sgl, int nents)
> > > for_each_sg(sgl, sg, nents, i)
> > > pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
> > > i, nents, sg, sg->length, sg->offset, sg_page(sg),
> > > - sg_dma_address(sg), sg_dma_len(sg));
> > > + (u64)sg_dma_address(sg), sg_dma_len(sg));
[]
> > You could create a temporary:
for_each_sg(sgl, sg, nents, i) {
dma_addr_t addr = sg_dma_address(sg);
pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma %pad, %u\n",
i, nents, sg, sg->length, sg->offset, sg_page(sg),
&addr, sg_dma_len(sg));
}
Sure, but the cast seemed nicer in this case, the result is the same.
Not quite as 0x%llx isn't always the same width and doesn't
have leading 0's like %pad
[toc] | [prev] | [next] | [standalone]
| From | Varun Prakash <varun@chelsio.com> |
|---|---|
| Date | 2016-03-07 15:20 +0100 |
| Message-ID | <ra4aS-3TP-17@gated-at.bofh.it> |
| In reply to | #1350695 |
On Sat, Mar 05, 2016 at 01:04:41AM +0100, Arnd Bergmann wrote:
> The newly added driver prints a dma_addr_t using the %llx format string,
> but that is wrong on most 32-bit architectures:
>
> drivers/target/iscsi/cxgbit/cxgbit_ddp.c: In function 'cxgbit_dump_sgl':
> drivers/target/iscsi/cxgbit/cxgbit_ddp.c:180:10: error: format '%llx' expects argument of type 'long long unsigned int', but argument 8 has type 'dma_addr_t {aka unsigned int}' [-Werror=format=]
> pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
>
> Unfortunately, we can't use the %pad format string here because
> we are not printing an lvalue, so we have to add a cast to u64, which
> matches the format string on all architectures.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: c49aa56e556d ("cxgbit: add cxgbit_ddp.c")
> ---
> drivers/target/iscsi/cxgbit/cxgbit_ddp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> index 07e2bc86d0df..d667bc88e21d 100644
> --- a/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> +++ b/drivers/target/iscsi/cxgbit/cxgbit_ddp.c
> @@ -179,7 +179,7 @@ cxgbit_dump_sgl(const char *cap, struct scatterlist *sgl, int nents)
> for_each_sg(sgl, sg, nents, i)
> pr_info("\t%d/%u, 0x%p: len %u, off %u, pg 0x%p, dma 0x%llx, %u\n",
> i, nents, sg, sg->length, sg->offset, sg_page(sg),
> - sg_dma_address(sg), sg_dma_len(sg));
> + (u64)sg_dma_address(sg), sg_dma_len(sg));
> }
>
> static int cxgbit_ddp_sgl_check(struct scatterlist *sgl, int nents)
Ok, I will update the original commit in v2 series, thanks.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web