Re: [PATCH] nfs: fix compilation warning

From: Geert Uytterhoeven
Date: Fri Mar 11 2011 - 12:30:30 EST


On Thu, Mar 3, 2011 at 00:19, <bookjovi@xxxxxxxxx> wrote:
> From: Jovi Zhang <bookjovi@xxxxxxxxx>
>
> this commit fix compilation warning as following:
> linux-2.6/fs/nfs/nfs4proc.c:3265: warning: comparison of distinct pointer types lacks a cast

And as the offender is on track for 2.6.37.4-stable, it needs to be
applied there, too.

> Signed-off-by: Jovi Zhang <bookjovi@xxxxxxxxx>
> ---
> Âfs/nfs/nfs4proc.c | Â Â2 +-
> Â1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 1ff76ac..c7eb4ee 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3262,7 +3262,7 @@ static int buf_to_pages_noslab(const void *buf, size_t buflen,
> Â Â Â Âspages = pages;
>
> Â Â Â Âdo {
> - Â Â Â Â Â Â Â len = min(PAGE_CACHE_SIZE, buflen);
> + Â Â Â Â Â Â Â len = min((size_t)PAGE_CACHE_SIZE, buflen);

Alternatively, we could use

len = min_t(size_t, PAGE_CACHE_SIZE, buflen);

which may be somewhat cleaner, as it doesn't add an explicit cast.

> Â Â Â Â Â Â Â Ânewpage = alloc_page(GFP_KERNEL);
>
> Â Â Â Â Â Â Â Âif (newpage == NULL)

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/