From: "Wysocki, Rafael J" <rafael.j.wysocki@intel.com>
To: Xueqin Luo <luoxueqin@kylinos.cn>, <herton@canonical.com>,
<hansg@kernel.org>, <ilpo.jarvinen@linux.intel.com>,
<platform-driver-x86@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH] platform/x86: Add ACPI_COMPANION() NULL check in topstar_acpi_probe
Date: Wed, 12 Aug 2026 20:10:12 +0200 [thread overview]
Message-ID: <57f89d3a-e2ab-4a79-9bfb-719678671b9a@intel.com> (raw)
In-Reply-To: <20260811022115.338595-1-luoxueqin@kylinos.cn>
On 8/11/2026 4:21 AM, Xueqin Luo wrote:
> Add NULL check for ACPI_COMPANION() in topstar_acpi_probe() to prevent
> NULL pointer dereference when driver_override matches a device without
> ACPI companion.
>
> Fixes: 3471415c8186 ("platform/x86: topstar-laptop: Convert ACPI driver to a platform one")
> Signed-off-by: Xueqin Luo <luoxueqin@kylinos.cn>
I'm not sure why I haven't sent a patch to address this, so
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/platform/x86/topstar-laptop.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c
> index 0e842c55dcc5..730a599abf0f 100644
> --- a/drivers/platform/x86/topstar-laptop.c
> +++ b/drivers/platform/x86/topstar-laptop.c
> @@ -287,10 +287,14 @@ static const struct dmi_system_id topstar_dmi_ids[] = {
>
> static int topstar_acpi_probe(struct platform_device *pdev)
> {
> - struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
> + struct acpi_device *device;
> struct topstar_laptop *topstar;
> int err;
>
> + device = ACPI_COMPANION(&pdev->dev);
> + if (!device)
> + return -ENODEV;
> +
> dmi_check_system(topstar_dmi_ids);
>
> topstar = kzalloc_obj(struct topstar_laptop);
parent reply other threads:[~2026-08-12 18:10 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20260811022115.338595-1-luoxueqin@kylinos.cn>]
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=57f89d3a-e2ab-4a79-9bfb-719678671b9a@intel.com \
--to=rafael.j.wysocki@intel.com \
--cc=hansg@kernel.org \
--cc=herton@canonical.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luoxueqin@kylinos.cn \
--cc=platform-driver-x86@vger.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