Re: [PATCH v2][next] scsi: lpfc: Use struct_size() helper

From: Kees Cook
Date: Fri May 26 2023 - 13:42:26 EST


On Tue, May 23, 2023 at 10:25:20PM -0700, Justin Tee wrote:
> no_of_objects may be hardcoded to 1 right now, but does it make more
> sense to use?
>
> struct_size(rap, obj, be32_to_cpu(rap->no_of_objects));

Oh yeah, that's nicer. :)

> We probably should have declared no_of_objects as __be32 to have
> avoided this confusion.

Perhaps this patch can add that too?

--
Kees Cook