driver core: platform: Check for NULL name in platform_get_resource_byname
PATCH 1/1 driver core: platform: Check for NULL name in platform_get_resource_byname
From: "Dr. David Alan Gilbert" <[email protected]>
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.
Signed-off-by Dr. David Alan Gilbert <[email protected]>
--- drivers/base/platform.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/base/platform.c +3 -0
@@ -464,6 +464,9 @@ struct resource *platform_get_resource_byname(struct platform_device *dev, {u32 i; +if (unlikely (!name)) +return NULL ; +for (i =0 ; i < dev->num_resources; i++) {struct resource *r = &dev->resource[i];
Signature · 1 line
2.56.1