Re: [RFC PATCH 0/3] Introduce kernel small arrays (KSA)

From: Ben Hutchings
Date: Wed Oct 04 2017 - 11:22:40 EST


On Tue, 2017-09-19 at 12:30 +0400, Ilya Matveychikov wrote:
> Hi guys,
>
> Please review the approach of using small fixed-sized arrays to improve
> parsing of values like get_options() does.
>
> This comes to me after fixing an overflow in get_options(). See the thread
> for details: https://lkml.org/lkml/2017/5/22/581
>
> If the approach is OK Iâll suggest to replace all of get_options() calls
> to ksa_parse_ints() and remove get_options() at all.

You didn't cc the patches to me, and I can't find patch 3/3 at all.

I don't think the KSA() macro should be casting its argument. Where the
cast is necessary, it ought to be explicit in the caller.

Similarly I think the BUILD_BUG_ON() in ksa_build_check() doesn't belong
there, but in whichever caller of ksa_parse_ints() requires struct
ksmall_array to have the same layout as a simple array of unsigned int.

Ben.

--
Ben Hutchings
Software Developer, Codethink Ltd.