Re: [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command
From: Robert Abel
Date: Wed Feb 14 2018 - 18:18:09 EST
On 13 Feb 2018 14:36, Andy Shevchenko wrote:
> I understand that we have a huge and hopefully nice library in the
> kernel, but the question still the same, what prevents a developer or
> maintainer to look at it from time to time?
>
> For, I dare to say, ages we have hex_to_bin() and hex2bin().
> Can we use it?
hex_to_bin look fine to me, although personally I'm not a big fan of its
use of tolower.
The current parser implementation is much more lenient than hex2bin,
however. hex2bin won't parse strings containing illegal characters
(which are currently skipped) or hexadecimal strings with an odd number
of digits (which are currently allowed and the final digit will be ignored).
I noticed the only part of the code that does make use of library
functions, parsing x and y coordinates using kstrtoul, is broken.
Apparently it used to use simple_strtoul, which worked and then got
replaced. So apparently looking over the kernel lib from time to time
can also do some harm ;)
Patch incoming :)
Regards,
Robert