* [PATCH] rbd: Use min_t() to fix comparison of distinct pointer types warning
@ 2013-05-08 20:02 Geert Uytterhoeven
2013-05-08 20:36 ` Alex Elder
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2013-05-08 20:02 UTC (permalink / raw)
To: Alex Elder; +Cc: ceph-devel, linux-kernel, Geert Uytterhoeven
drivers/block/rbd.c: In function ‘zero_pages’:
drivers/block/rbd.c:1102: warning: comparison of distinct pointer types lacks a cast
Remove the hackish casts and use min_t() to fix this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
drivers/block/rbd.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 22ffd5d..1318c6b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1098,8 +1098,8 @@ static void zero_pages(struct page **pages, u64 offset, u64 end)
unsigned long flags;
void *kaddr;
- page_offset = (size_t)(offset & ~PAGE_MASK);
- length = min(PAGE_SIZE - page_offset, (size_t)(end - offset));
+ page_offset = offset & ~PAGE_MASK;
+ length = min_t(size_t, PAGE_SIZE - page_offset, end - offset);
local_irq_save(flags);
kaddr = kmap_atomic(*page);
memset(kaddr + page_offset, 0, length);
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rbd: Use min_t() to fix comparison of distinct pointer types warning
2013-05-08 20:02 [PATCH] rbd: Use min_t() to fix comparison of distinct pointer types warning Geert Uytterhoeven
@ 2013-05-08 20:36 ` Alex Elder
0 siblings, 0 replies; 2+ messages in thread
From: Alex Elder @ 2013-05-08 20:36 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: ceph-devel, linux-kernel
On 05/08/2013 03:02 PM, Geert Uytterhoeven wrote:
> drivers/block/rbd.c: In function ‘zero_pages’:
> drivers/block/rbd.c:1102: warning: comparison of distinct pointer types lacks a cast
>
> Remove the hackish casts and use min_t() to fix this.
Looks good to me. I'm not sure why I didn't use that to
begin with.
I'll pull this into the ceph tree. Thanks a lot.
Reviewed-by: Alex Elder <elder@inktank.com>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> drivers/block/rbd.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 22ffd5d..1318c6b 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1098,8 +1098,8 @@ static void zero_pages(struct page **pages, u64 offset, u64 end)
> unsigned long flags;
> void *kaddr;
>
> - page_offset = (size_t)(offset & ~PAGE_MASK);
> - length = min(PAGE_SIZE - page_offset, (size_t)(end - offset));
> + page_offset = offset & ~PAGE_MASK;
> + length = min_t(size_t, PAGE_SIZE - page_offset, end - offset);
> local_irq_save(flags);
> kaddr = kmap_atomic(*page);
> memset(kaddr + page_offset, 0, length);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-08 20:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 20:02 [PATCH] rbd: Use min_t() to fix comparison of distinct pointer types warning Geert Uytterhoeven
2013-05-08 20:36 ` Alex Elder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox