linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfs: fix compilation warning
@ 2011-03-02 23:19 bookjovi
       [not found] ` <20110305160153.a37899b3.rdunlap@xenotime.net>
  2011-03-11 17:22 ` Geert Uytterhoeven
  0 siblings, 2 replies; 3+ messages in thread
From: bookjovi @ 2011-03-02 23:19 UTC (permalink / raw)
  To: bookjovi; +Cc: Trond Myklebust, open list:NFS, SUNRPC, AND..., open list

From: Jovi Zhang <bookjovi@gmail.com>

this commit fix compilation warning as following:
linux-2.6/fs/nfs/nfs4proc.c:3265: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
---
 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);
 		newpage = alloc_page(GFP_KERNEL);
 
 		if (newpage == NULL)
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nfs: fix compilation warning
       [not found] ` <20110305160153.a37899b3.rdunlap@xenotime.net>
@ 2011-03-07  4:11   ` Jovi Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Jovi Zhang @ 2011-03-07  4:11 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: open list:NFS, linux-kernel@vger.kernel.org (open list)

On Sun, Mar 6, 2011 at 8:01 AM, Randy Dunlap <rdunlap@xenotime.net> wro=
te:
> On Wed, =C2=A02 Mar 2011 18:19:37 -0500 bookjovi@gmail.com wrote:
>
>> From: Jovi Zhang <bookjovi@gmail.com>
>>
>> this commit fix compilation warning as following:
>> linux-2.6/fs/nfs/nfs4proc.c:3265: warning: comparison of distinct po=
inter types lacks a cast
>>
>> Signed-off-by: Jovi Zhang <bookjovi@gmail.com>
>> ---
>> =C2=A0fs/nfs/nfs4proc.c | =C2=A0 =C2=A02 +-
>> =C2=A01 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,
>> =C2=A0 =C2=A0 =C2=A0 spages =3D pages;
>>
>> =C2=A0 =C2=A0 =C2=A0 do {
>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 len =3D min(PAGE_CACHE_S=
IZE, buflen);
>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 len =3D min((size_t)PAGE=
_CACHE_SIZE, buflen);
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 newpage =3D alloc_p=
age(GFP_KERNEL);
>>
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (newpage =3D=3D =
NULL)
>> --
>
> or use
> =C2=A0 =C2=A0 =C2=A0 =C2=A0len =3D min_t(size_t, PAGE_SIZE_CACHE, buf=
len);
>
That's good, Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nfs: fix compilation warning
  2011-03-02 23:19 [PATCH] nfs: fix compilation warning bookjovi
       [not found] ` <20110305160153.a37899b3.rdunlap@xenotime.net>
@ 2011-03-11 17:22 ` Geert Uytterhoeven
  1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2011-03-11 17:22 UTC (permalink / raw)
  To: bookjovi
  Cc: Trond Myklebust, open list:NFS, SUNRPC, AND..., open list,
	Greg Kroah-Hartman, stable

On Thu, Mar 3, 2011 at 00:19,  <bookjovi@gmail.com> wrote:
> From: Jovi Zhang <bookjovi@gmail.com>
>
> 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@gmail.com>
> ---
>  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@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-11 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-02 23:19 [PATCH] nfs: fix compilation warning bookjovi
     [not found] ` <20110305160153.a37899b3.rdunlap@xenotime.net>
2011-03-07  4:11   ` Jovi Zhang
2011-03-11 17:22 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).