[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+HOOsiP-uLJPJzn=24XiodaK89-y7Fy8oj+ALnbw4iHdtGR5A@mail.gmail.com>
Date: Fri, 23 Jan 2015 18:55:36 +0530
From: Anshul Garg <aksgarg1989@...il.com>
To: Jeff Epler <jepler@...ythonic.net>
Cc: akpm@...ux-foundation.org, Levente Kurusa <levex@...ux.com>,
Felipe Contreras <felipe.contreras@...il.com>,
linux-kernel@...r.kernel.org,
"anshul.g@...sung.com" <anshul.g@...sung.com>
Subject: Re: [PATCH] lib/kstrtox.c clean kstrtoll function
Dear Mr. Jeff,
Thanks for the comments.
Yes i think overflow check logic is wrong.
So i think we can change the overflow logic -
>From --
if ((long long)tmp < 0)
+ return -ERANGE;
to -
if (((long long)tmp < LLONG_MIN) || ((long long)tmp > LLONG_MAX) )
+ return -ERANGE;
Please give your views on this change..
If this change seems correct i will update overflow logic
in my sent patch.
Hope to hear from you soon.
Thanks
Anshul Garg
On Thu, Jan 22, 2015 at 10:55 PM, Jeff Epler <jepler@...ythonic.net> wrote:
> On Thu, Jan 22, 2015 at 05:54:10AM -0800, Anshul Garg wrote:
>> - if ((long long)(-tmp) >= 0)
>> - return -ERANGE;
>> - *res = -tmp;
> ...
>> + if ((long long)tmp < 0)
>> + return -ERANGE;
>> + *res = sign * tmp;
>
> I don't believe overflow handling is correct anymore with this patch.
> Did you try with the input as the most negative possible unsigned long?
>
> Jeff
--
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