aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-08-23 10:10:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-06 16:29:11 -0400
commit1b8cb9290671a4c025c16a51d316031f9ec04976 (patch)
treea335e3cb404474a9420b4e3f07044128c8f5e499 /drivers/base
parent45f035ab9b8f45aaf1eb2213218b7e9c14af3fc2 (diff)
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 <peter.ujfalusi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/platform.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 3f8077ce585c..ddeca142293c 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -103,6 +103,9 @@ struct resource *platform_get_resource_byname(struct platform_device *dev,
103 for (i = 0; i < dev->num_resources; i++) { 103 for (i = 0; i < dev->num_resources; i++) {
104 struct resource *r = &dev->resource[i]; 104 struct resource *r = &dev->resource[i];
105 105
106 if (unlikely(!r->name))
107 continue;
108
106 if (type == resource_type(r) && !strcmp(r->name, name)) 109 if (type == resource_type(r) && !strcmp(r->name, name))
107 return r; 110 return r;
108 } 111 }