From: Greg KH <gregkh@linuxfoundation.org>
To: linux@treblig.org
Cc: dave@treblig.org, rafael@kernel.org, dakr@kernel.org,
johan@kernel.org, driver-core@lists.linux.dev
Subject: Re: [PATCH] driver core: platform: Check for NULL name in platform_get_resource_byname
Date: Thu, 19 Nov 2026 14:20:19 +0100 [thread overview]
Message-ID: <2026111930-swagger-emit-3a58@gregkh> (raw)
In-Reply-To: <20261119001820.168018-1-linux@treblig.org>
On Thu, Nov 19, 2026 at 12:18:20AM +0000, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> Drivers are calling platform_get_resource_byname() with a name string
> derived from a DT. If that's a DT that's broken without the field
> that should land in the name field, a NULL is passed and it OOPSs
> in the strcmp. Check for a NULL name and return NULL; turning
> a crash into one broken device.
Nope, this is as-intended, fix the DT :)
Also:
> @@ -464,6 +464,9 @@ struct resource *platform_get_resource_byname(struct platform_device *dev,
> {
> u32 i;
>
> + if (unlikely(!name))
> + return NULL;
Only ever use unlikely/likely if you can measure the difference with it
not being there. For a call like this, you can't :)
thanks,
greg k-h
next prev parent reply other threads:[~2026-11-19 13:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 0:18 [PATCH] driver core: platform: Check for NULL name in platform_get_resource_byname linux
2026-11-19 13:20 ` Greg KH [this message]
2026-11-19 13:37 ` Dr. David Alan Gilbert
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=2026111930-swagger-emit-3a58@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dakr@kernel.org \
--cc=dave@treblig.org \
--cc=driver-core@lists.linux.dev \
--cc=johan@kernel.org \
--cc=linux@treblig.org \
--cc=rafael@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