Re: [PATCH] [next] pcmcia: synclink_cs: replace 1-element array with flex-array member

From: Kees Cook
Date: Wed Dec 14 2022 - 16:49:07 EST


On Wed, Dec 14, 2022 at 10:39:52PM +0200, Andy Shevchenko wrote:
> Yes, and Try to make it work with __packed. As I said, the problem is
> that the code is relying on something which is architecture dependent
> strictly speaking. And hence I disagree with Kees that v2 is okay to
> go.

I meant that v2 is functionally identical to the existing code.

> The full change should be something like
>
> check_add(sizeof(), max_frame_size)
> kcalloc(8, size)

Right -- this would fix the existing mistakes in size calculation (and
is certainly better).

--
Kees Cook