From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>,
Tomas Winkler <tomas.winkler@intel.com>,
Wentong Wu <wentong.wu@intel.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH 3/3] mei: vsc: Assign pinfo fields in variable declaration
Date: Mon, 12 Feb 2024 10:14:54 +0000 [thread overview]
Message-ID: <ZcnvnjAYDTRcNBFm@kekkonen.localdomain> (raw)
In-Reply-To: <2024021210-freeway-unblessed-d966@gregkh>
Hi Greg,
Thanks for the review.
On Mon, Feb 12, 2024 at 11:02:04AM +0100, Greg Kroah-Hartman wrote:
> On Mon, Feb 12, 2024 at 11:46:18AM +0200, Sakari Ailus wrote:
> > Assign all possible fields of pinfo in variable declaration, instead of
> > just zeroing it there.
> >
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> > drivers/misc/mei/vsc-tp.c | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/misc/mei/vsc-tp.c b/drivers/misc/mei/vsc-tp.c
> > index 200af14490d7..1eda2860f63b 100644
> > --- a/drivers/misc/mei/vsc-tp.c
> > +++ b/drivers/misc/mei/vsc-tp.c
> > @@ -447,11 +447,16 @@ static int vsc_tp_match_any(struct acpi_device *adev, void *data)
> >
> > static int vsc_tp_probe(struct spi_device *spi)
> > {
> > - struct platform_device_info pinfo = { 0 };
> > + struct vsc_tp *tp;
> > + struct platform_device_info pinfo = {
> > + .name = "intel_vsc",
> > + .data = &tp,
> > + .size_data = sizeof(tp),
> > + .id = PLATFORM_DEVID_NONE,
> > + };
>
> But now you have potential stack data in the structure for the fields
> that you aren't assigning here, right? Is that acceptable, or will it
> leak somewhere?
Hmm. I'm not quite sure what you mean.
The patch changes where the fields are assigned but the variable is only
used when the assignment is done in any case, so this doesn't change
anything.
>
> This is why we generally do not do this type of style. So unless you
> are fixing an issue here, please don't do it.
The only caveat in initialising a struct is that the possible holes due to
ABI aren't initialised, which generally is a concern with UAPI or network
(i.e. not here, and the patch doesn't change that anyway).
--
Regards,
Sakari Ailus
prev parent reply other threads:[~2024-02-12 10:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 9:46 [PATCH 0/3] MEI VSC fixes and cleanups Sakari Ailus
2024-02-12 9:46 ` [PATCH 1/3] mei: vsc: Call wake_up() and event handler in a workqueue Sakari Ailus
2024-02-18 1:23 ` Wu, Wentong
2024-02-19 18:18 ` Sakari Ailus
2024-02-12 9:46 ` [PATCH 2/3] mei: vsc: Don't use sleeping condition in wait_event_timeout() Sakari Ailus
2024-02-12 9:46 ` [PATCH 3/3] mei: vsc: Assign pinfo fields in variable declaration Sakari Ailus
2024-02-12 10:02 ` Greg Kroah-Hartman
2024-02-12 10:14 ` Arnd Bergmann
2024-02-12 10:41 ` Greg Kroah-Hartman
2024-02-12 10:14 ` Sakari Ailus [this message]
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=ZcnvnjAYDTRcNBFm@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tomas.winkler@intel.com \
--cc=wentong.wu@intel.com \
/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
all inboxes | Powered by JetHome®