On Fri, Jan 23, 2015 at 06:55:36PM +0530, Anshul Garg wrote:
> if (((long long)tmp < LLONG_MIN) || ((long long)tmp > LLONG_MAX) )
> + return -ERANGE;
This proposed code is still wrong (-ERANGE can never be returned by this
statement). It may be best to leave the code alone, rather than propose
m
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 view
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 hand
From: Anshul Garg
Instead of having same code for negative and postive
integer, use sign variable for integer parsing.
Signed-off-by: Anshul Garg
---
lib/kstrtox.c | 24 ++--
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/lib/kstrtox.c b/lib/kstrtox.c
ind
4 matches
Mail list logo