[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2024021210-freeway-unblessed-d966@gregkh>
Date: Mon, 12 Feb 2024 11:02:04 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
Tomas Winkler <tomas.winkler@...el.com>,
Wentong Wu <wentong.wu@...el.com>, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH 3/3] mei: vsc: Assign pinfo fields in variable declaration
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@...ux.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?
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.
thanks,
greg k-h
Powered by blists - more mailing lists