[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D958900912E20642BCBC71664EFECE3E6DCAB86F5D@BGMAIL02.nvidia.com>
Date: Wed, 23 Nov 2011 09:22:11 +0530
From: Venu Byravarasu <vbyravarasu@...dia.com>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: "torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"a.zummo@...ertech.it" <a.zummo@...ertech.it>,
"bunk@...nel.org" <bunk@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] bcd: limit bin2bcd input value to lie between 0-99
> >
> > e.g. say val passed to bin2bcd is 123.
> > In that case the expected value to be returned by
> > this function is 0x23.
> > However, without the fix being added, it would
> > return 0xC3.
> >
>
> I'm not sure that I agree. Passing 123 to bin2bcd() is a bug, isn't
> it? We want to know about bugs so we can fix them, and quietly repairing
> thngs in callees prevents that.
As bin2bcd is having "unsigned val" as parameter, I do not understand why passing 123 is a bug.
123 that I mentioned here in my example is a decimal value, which is very well within unsigned char limits.
Even any value beyond 99 would create this problem, as the values are not really getting stored as BCD, where each nibble value is to be limited to stay within 0 to 9.
Probably it would be better to change the param of "bin2bcd" from "unsigned val" to "unsigned char" itself.
--
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