From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Stephen Hemminger <sthemmin@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Jiri Kosina <jikos@kernel.org>,
linux-hyperv@vger.kernel.org, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] [next] HID: hyperv: Replace one-element array with flexible-array member
Date: Mon, 17 Oct 2022 22:30:33 +1300 [thread overview]
Message-ID: <Y00guZiaxDbFaGhX@mail.google.com> (raw)
In-Reply-To: <CAO-hwJ+q+fsmjKY=BjDazBjUDD3755VhRxWw628=xxC9ePWzqA@mail.gmail.com>
On Mon, Oct 17, 2022 at 10:30:54AM +0200, Benjamin Tissoires wrote:
> On Mon, Oct 17, 2022 at 9:51 AM Paulo Miguel Almeida
> <paulo.miguel.almeida.rodenas@gmail.com> wrote:
> >
> > One-element arrays are deprecated, and we are replacing them with
> > flexible array members instead. So, replace one-element array with
> > flexible-array member in structs synthhid_msg, synthhid_input_report,
> > pipe_prt_msg and refactor the rest of the code accordingly.
> >
> > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> > routines on memcpy() and help us make progress towards globally
> > enabling -fstrict-flex-arrays=3 [1].
> >
> > Link: https://github.com/KSPP/linux/issues/79
> > Link: https://github.com/KSPP/linux/issues/210
> > Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]
> >
> > Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> > ---
>
> FWIW, this is
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
>
Thanks for reviewing this patch :-)
> > +++ b/drivers/hid/hid-hyperv.c
> > @@ -61,7 +61,7 @@ struct synthhid_msg_hdr {
> >
> > struct synthhid_msg {
> > struct synthhid_msg_hdr header;
> > - char data[1]; /* Enclosed message */
> > + char data[]; /* Enclosed message */
> > };
>
> IMO that struct has no real use. We just use it in
> mousevsc_on_receive() to dereference the first field only, the header.
> So how about we have a followup cleanup patch that just removes it and
> in mousevsc_on_receive() we convert those usages directly to struct
> synthhid_msg_hdr?
>
> Cheers,
> Benjamin
I'm happy to send a followup cleanup patch for that.
Paulo A.
next prev parent reply other threads:[~2022-10-17 9:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 7:51 [PATCH] [next] HID: hyperv: Replace one-element array with flexible-array member Paulo Miguel Almeida
2022-10-17 8:30 ` Benjamin Tissoires
2022-10-17 9:30 ` Paulo Miguel Almeida [this message]
2022-10-17 15:15 ` Michael Kelley (LINUX)
2022-10-18 12:56 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y00guZiaxDbFaGhX@mail.google.com \
--to=paulo.miguel.almeida.rodenas@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=jikos@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sthemmin@microsoft.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).