mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@lists.linux-m68k.org
Cc: Lee Jones <lee.jones@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] m68k: Fix virt_addr_valid() W=1 compiler warnings
Date: Tue, 23 Feb 2021 23:02:14 +1000	[thread overview]
Message-ID: <bbb367f6-4f6d-027c-f0b7-345a24fdea0c@linux-m68k.org> (raw)
In-Reply-To: <20210223104957.2209219-1-geert@linux-m68k.org>


On 23/2/21 8:49 pm, Geert Uytterhoeven wrote:
> If CONFIG_DEBUG_SG=y, and CONFIG_MMU=y:
> 
>      include/linux/scatterlist.h: In function ‘sg_set_buf’:
>      arch/m68k/include/asm/page_mm.h:174:49: warning: ordered comparison of pointer with null pointer [-Wextra]
>        174 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
> 	  |                                                 ^~
> 
> or CONFIG_MMU=n:
> 
>      include/linux/scatterlist.h: In function ‘sg_set_buf’:
>      arch/m68k/include/asm/page_no.h:33:50: warning: ordered comparison of pointer with null pointer [-Wextra]
>         33 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
> 	  |                                                  ^~
> 
> Fix this by doing the comparison in the "unsigned long" instead of the
> "void *" domain.
> 
> Note that for now this is only seen when compiling btrfs, due to commit
> e9aa7c285d20a69c ("btrfs: enable W=1 checks for btrfs"), but as people
> are doing more W=1 compile testing, it will start to show up elsewhere,
> too.
> 
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Acked-by: Greg Ungerer <gerg@linux-m68k.org>


> ---
> Probably we want this as a fix for v5.12, to avoid the build bots
> nagging about it all the time?
> 
>   arch/m68k/include/asm/page_mm.h | 2 +-
>   arch/m68k/include/asm/page_no.h | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h
> index 7f5912af2a52ea0a..9b1672f9b2e22cdf 100644
> --- a/arch/m68k/include/asm/page_mm.h
> +++ b/arch/m68k/include/asm/page_mm.h
> @@ -171,7 +171,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void)
>   #include <asm-generic/memory_model.h>
>   #endif
>   
> -#define virt_addr_valid(kaddr)	((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
> +#define virt_addr_valid(kaddr)	((unsigned long)(kaddr) >= PAGE_OFFSET && ((unsigned long)kaddr) < (unsigned long)high_memory)
>   #define pfn_valid(pfn)		virt_addr_valid(pfn_to_virt(pfn))
>   
>   #endif /* __ASSEMBLY__ */
> diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
> index 6bbe52025de3c5c6..8d0f862ee9d79532 100644
> --- a/arch/m68k/include/asm/page_no.h
> +++ b/arch/m68k/include/asm/page_no.h
> @@ -30,8 +30,8 @@ extern unsigned long memory_end;
>   #define page_to_pfn(page)	virt_to_pfn(page_to_virt(page))
>   #define pfn_valid(pfn)	        ((pfn) < max_mapnr)
>   
> -#define	virt_addr_valid(kaddr)	(((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
> -				((void *)(kaddr) < (void *)memory_end))
> +#define	virt_addr_valid(kaddr)	(((unsigned long)(kaddr) >= PAGE_OFFSET) && \
> +				((unsigned long)(kaddr) < memory_end))
>   
>   #endif /* __ASSEMBLY__ */
>   
> 

  reply	other threads:[~2021-02-23 13:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 10:49 Geert Uytterhoeven
2021-02-23 13:02 ` Greg Ungerer [this message]
2021-03-05  8:37 ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bbb367f6-4f6d-027c-f0b7-345a24fdea0c@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=arnd@arndb.de \
    --cc=geert@linux-m68k.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®