[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH2r5mtaf6Kmg2RAxawsV9o=VHyu9hosqa4fZw5QDHLH-tacfg@mail.gmail.com>
Date: Sun, 17 Jan 2021 20:08:21 -0600
From: Steve French <smfrench@...il.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Aurélien Aptel <aaptel@...e.com>,
Jiapeng Zhong <abaci-bugfix@...ux.alibaba.com>,
Steve French <sfrench@...ba.org>,
CIFS <linux-cifs@...r.kernel.org>,
samba-technical <samba-technical@...ts.samba.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] fs/cifs: Replace one-element array with flexible-array member.
On Sun, Jan 17, 2021 at 6:02 PM Al Viro <viro@...iv.linux.org.uk> wrote:
>
> On Sun, Jan 17, 2021 at 03:58:23PM -0600, Steve French wrote:
> > Jiapeng,
> > Aurelien is correct, you should respin this patch and correct for
> > where it breaks the sizeof calculation. For example your change:
> >
> > struct smb2_lock_rsp {
> > @@ -1434,7 +1434,7 @@ struct smb2_query_directory_req {
> > __le16 FileNameOffset;
> > __le16 FileNameLength;
> > __le32 OutputBufferLength;
> > - __u8 Buffer[1];
> > + __u8 Buffer[];
> > } __packed;
> >
> > would have the side effect of making the file name off by one:
> >
> > smb2pdu.c-4654- req->FileNameOffset =
> > smb2pdu.c:4655: cpu_to_le16(sizeof(struct
> > smb2_query_directory_req) - 1);
>
> FWIW, that sizeof() - 1 should've been offsetof()...
agreed
--
Thanks,
Steve
Powered by blists - more mailing lists