mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
driver core: Check if r->name is valid in platform_get_resource_byname()
Safety check for the validity of the resource name before calling strcmp(). If the resource name is NULL do not compare it, just skip it. Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
45f035ab9b
commit
1b8cb92906
1 changed files with 3 additions and 0 deletions
|
|
@ -103,6 +103,9 @@ struct resource *platform_get_resource_byname(struct platform_device *dev,
|
|||
for (i = 0; i < dev->num_resources; i++) {
|
||||
struct resource *r = &dev->resource[i];
|
||||
|
||||
if (unlikely(!r->name))
|
||||
continue;
|
||||
|
||||
if (type == resource_type(r) && !strcmp(r->name, name))
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue