Re: [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command

From: Andy Shevchenko
Date: Thu Feb 15 2018 - 05:57:43 EST


On Thu, Feb 15, 2018 at 1:17 AM, Robert Abel <rabel@xxxxxxxxxxxxx> wrote:
> 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.

Let's duplicate then over and over?

> 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).

Can you point to the documentation where user can easily (w/o reading
the code) get how it suppose to be?

Besides that, I'm a fan of making things cleaner and stricter.
Allowing garbage in the middle of hex digits is making odd and
unflexible interface.

> 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.

By which commit?

> So apparently looking over the kernel lib from time to time
> can also do some harm ;)

Disagree. The careless (semi-)automated patches and / or negligent
review make this so.
See Markus Elfting phenomena. He dumbly doing routine work w/o paying
attention to the details and breaking things. That's why half of
maintainers already banned him.

> Patch incoming :)

Can you Cc me?

--
With Best Regards,
Andy Shevchenko