From patchwork Fri Oct 23 16:50:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 55507 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1357042lbq; Fri, 23 Oct 2015 09:51:54 -0700 (PDT) X-Received: by 10.66.232.40 with SMTP id tl8mr5980436pac.122.1445619114566; Fri, 23 Oct 2015 09:51:54 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ct3si30752868pad.103.2015.10.23.09.51.54; Fri, 23 Oct 2015 09:51:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752911AbbJWQvl (ORCPT + 28 others); Fri, 23 Oct 2015 12:51:41 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:36267 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752766AbbJWQvk (ORCPT ); Fri, 23 Oct 2015 12:51:40 -0400 Received: by pacfv9 with SMTP id fv9so128493708pac.3 for ; Fri, 23 Oct 2015 09:51:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=aPwVjoRw8uKPezZEUnj4pFYM3UaIZh+BJhsoTUHB0fU=; b=TSo2aWnoe5i+YXfFRMOxd6FtJzqw4WuWnOBQGilaOBKXhizBjmbG06eOWHKZyLvQb6 vxOxBaQuxGksykrR+klQGtaPwM3Uc1pg7rtAAYAWhWvHuNFkAS3btQW0z9e2CZvdCfDB b4Yk3Va4KSLj3bMH2QifGAX+GTkG/tBir1idFI0S3a8TOVSjEkXpwxhCYLe6H2/FcthD P+vWC7Mh0AksGrApzOz/HZRpOnZCSPnBM3qhl8sub9TjuPsPbLl+CM318mlimC/pvdrZ OXj50wIQQyh2JAsSbCCmoUcawZY34TDnYXx8DK9l2d+tjfGN9uJ3BeSE6bfBgRDngHu6 y9Mw== X-Gm-Message-State: ALoCoQkrhc8MNgPakaA8vlq4MOM/qz7Kv6QewKgik58v3CW+AoDGWhvO8Ed85ee5RanYt4SGnBVQ X-Received: by 10.68.228.200 with SMTP id sk8mr6220240pbc.115.1445619099300; Fri, 23 Oct 2015 09:51:39 -0700 (PDT) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id fk8sm19942197pab.33.2015.10.23.09.51.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Oct 2015 09:51:38 -0700 (PDT) From: Mathieu Poirier To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, tyler.baker@linaro.org, khilman@kernel.org Subject: [PATCH] coresight: checking for NULL string in coresight_name_match() Date: Fri, 23 Oct 2015 10:50:50 -0600 Message-Id: <1445619050-13036-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/hwtracing/coresight/coresight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/hwtracing/coresight/coresight.c b/drivers/hwtracing/coresight/coresight.c index e25492137d8b..93738dfbf631 100644 --- a/drivers/hwtracing/coresight/coresight.c +++ b/drivers/hwtracing/coresight/coresight.c @@ -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;