From patchwork Thu Dec 17 15:47:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 58600 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp446378lbb; Thu, 17 Dec 2015 07:47:26 -0800 (PST) X-Received: by 10.98.87.7 with SMTP id l7mr15094630pfb.124.1450367246792; Thu, 17 Dec 2015 07:47:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si12333747pfp.195.2015.12.17.07.47.26; Thu, 17 Dec 2015 07:47:26 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756352AbbLQPrP (ORCPT + 29 others); Thu, 17 Dec 2015 10:47:15 -0500 Received: from mail-io0-f179.google.com ([209.85.223.179]:35889 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755571AbbLQPrN (ORCPT ); Thu, 17 Dec 2015 10:47:13 -0500 Received: by mail-io0-f179.google.com with SMTP id o67so59030257iof.3 for ; Thu, 17 Dec 2015 07:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=G00gicNS9dBQVgAc2SUxmI3Bv9wHUyu31QE8HkXSJxY=; b=iTU2vgK5KSI4rSR7A9e+9kJjhfqKvDxJOu2ZAmSoi1ZAGdQHUEbw7FQ2H0IWdmfCt1 qmLmuoF1fpZa8aH/BXwSrZt2jS/7PQ7bCBf9BuT9j6RTmGFzOKkOMV2sS7h3KHVSePpl ZumVcIGU+j1ew5fBvOZSB5cCcMADZmrWingt4= 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:in-reply-to :references; bh=G00gicNS9dBQVgAc2SUxmI3Bv9wHUyu31QE8HkXSJxY=; b=lcLBLoYhiyYjGZNUp6Z9pey3b5A5+ink+EiiX+5OqbsSgxBO0hgRNCd8l4ixLoTzBB zrRfqx/vObGm4jLNvVxE/msf20g8GbHcBP93O+ixyphxng9zpbXMj223ZdHFVFqgrGjc rE11D6oOmlHHe6JUNinXyGCmCxyYrc5WsgBZqr+AoDOubAR51bpPd7MxTSxqrPKN+JpO XzCZb9D+bI88SPLovNYGWVLYY4/Iezj+trP3BdZvaCWKqoY59/hZXXgSvow2iuNiWoaf Beq/ZNY8f3i0BELfaJTsNJzBNzU3OUBNngM4664V7v/CNcB59PMlRnO3jr0rX8K0bpIG B3+A== X-Gm-Message-State: ALoCoQm8Evb8hm8l1uNVTmfMmgCquWSUinfkdcz0so+QHoraoW1nJIsz3RKQhIQ3AKxwsozz/+AOb8zyqsdgRv99XCCxr5inzQ== X-Received: by 10.107.17.160 with SMTP id 32mr51874547ior.28.1450367231931; Thu, 17 Dec 2015 07:47:11 -0800 (PST) Received: from t430.cg.shawcable.net ([184.64.168.246]) by smtp.gmail.com with ESMTPSA id i69sm4758510iod.27.2015.12.17.07.47.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Dec 2015 07:47:11 -0800 (PST) From: Mathieu Poirier To: gregkh@linuxfoundation.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] coresight: checking for NULL string in coresight_name_match() Date: Thu, 17 Dec 2015 08:47:02 -0700 Message-Id: <1450367223-21068-2-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1450367223-21068-1-git-send-email-mathieu.poirier@linaro.org> References: <1450367223-21068-1-git-send-email-mathieu.poirier@linaro.org> 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. Cc: # v3.18+ Reported-by: Tyler Baker Signed-off-by: Mathieu Poirier --- drivers/hwtracing/coresight/coresight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.1.4 -- 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;