]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
coresight: checking for NULL string in coresight_name_match()
authorMathieu Poirier <mathieu.poirier@linaro.org>
Fri, 23 Oct 2015 14:47:48 +0000 (08:47 -0600)
committerMathieu Poirier <mathieu.poirier@linaro.org>
Fri, 23 Oct 2015 14:54:12 +0000 (08:54 -0600)
Connection child names associated to ports can sometimes be NULL,
which is the case when booting a system on QEMU or when the Coresight
power domain isn't switched on.

This patch is adding a check to make sure a NULL string isn't fed
to strcmp(), something that avoid crashing the system.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
drivers/hwtracing/coresight/coresight.c

index e25492137d8bec86a5ff406ff1025724df095fbd..93738dfbf6313ea09f9f970ce463ec8374b4f661 100644 (file)
@@ -548,7 +548,7 @@ static int coresight_name_match(struct device *dev, void *data)
        to_match = data;
        i_csdev = to_coresight_device(dev);
 
-       if (!strcmp(to_match, dev_name(&i_csdev->dev)))
+       if (to_match && !strcmp(to_match, dev_name(&i_csdev->dev)))
                return 1;
 
        return 0;