[<prev] [next>] [day] [month] [year] [list]
Message-ID: <524f69650806221137u79aee360xb70aea7f9ccefc4b@mail.gmail.com>
Date: Sun, 22 Jun 2008 13:37:55 -0500
From: "Steve French" <smfrench@...il.com>
To: chrisw@...s-sol.org
Cc: "Suresh Jayaraman" <sjayaraman@...e.de>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH]: Supress a `comparison is always false' warning in fs/cifs/asn1.c
Chris,
Although this check seems harmless, shrinking the range to uint from
ulong makes sense as Suresh suggested and I was planning on adding
this to the cifs-2.6.git tree - but was not sure if you would prefer
to change both locations at once.
On Wed, Jun 11, 2008 at 2:15 AM, Suresh Jayaraman <sjayaraman@...e.de> wrote:
> On x86_64, I get this warning:
>
> fs/cifs/asn1.c: In function `asn1_oid_decode':
> fs/cifs/asn1.c:403: warning: comparison is always false due to limited
> range of data type
>
> Signed-off-by: Suresh Jayaraman <sjayaraman@...e.de>
> ---
>
> diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
> index f58e41d..4bdf809 100644
> --- a/fs/cifs/asn1.c
> +++ b/fs/cifs/asn1.c
> @@ -400,7 +400,7 @@ asn1_oid_decode(struct asn1_ctx *ctx,
> size = eoc - ctx->pointer + 1;
>
> /* first subid actually encodes first two subids */
> - if (size < 2 || size > ULONG_MAX/sizeof(unsigned long))
> + if (size < 2 || size > UINT_MAX/sizeof(unsigned int))
> return 0;
>
> *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC);
>
>
--
Thanks,
Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists