Re: [PATCH v2] smb3: Replace smb2pdu 1-element arrays with flex-arrays

From: Kees Cook
Date: Fri Feb 17 2023 - 19:13:12 EST


On Thu, Feb 16, 2023 at 11:25:01PM +0900, Namjae Jeon wrote:
> Hi Kees,
>
> > /* Read flags */
> > @@ -730,7 +730,7 @@ struct smb2_read_rsp {
> > __le32 DataLength;
> > __le32 DataRemaining;
> > __le32 Flags;
> > - __u8 Buffer[1];
> > + __u8 Buffer[];
> > } __packed;
> >
>
> You seem to have missed -1 removal in the code below.

Ah; thanks for this heads-up. I will need a v3.

> ./fs/cifs/smb2ops.c:5632: .read_rsp_size = sizeof(struct
> smb2_read_rsp) - 1,
> ./fs/cifs/smb2ops.c:5654: .read_rsp_size = sizeof(struct
> smb2_read_rsp) - 1,
...

These are interesting -- they don't show up at all in the code. What I
mean is that they're data-only changes. I'll add that to my before/after
build sanity checks.

Thanks!

-Kees

--
Kees Cook