From patchwork Wed Mar 14 17:10:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 131695 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp426532edg; Wed, 14 Mar 2018 10:11:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELtZWKMSm//cP9nXnjkM680MPR7o4A7i1ng9LrXXW2K99lIgKnhZ2xXWXBXvW45tuoEoidyo X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr4893058pls.58.1521047493282; Wed, 14 Mar 2018 10:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521047493; cv=none; d=google.com; s=arc-20160816; b=d04xc73ralIuSsfjf/oHD02mJ7k984PVr31kvhFf04SDgJzu2iqkCsPwfTMNLUl14D 4NKWtnE8KldIZE+voUcgru5/uZU47UWZ6lVKu6AI7eyn4/ptcGJoX58gUb785elaFQzF o5FIbZHneXxLnpO8yb+2VhADIa97IjEQNWSd/u6eGxQSabbLFLmiA5SjTCGV3Hm/bmuD ZO/wfalzxvecYuJyCs0BbrBLMPOemU4VOXQXNXYyfaYMsDttHuyQn2CLAs4vmFJQlE1U jxWDIhjg6kgWCYgvWyLIRteQ/jzAYjZJ3/1P5rUIYednp2dZQMz05YPELtdMtv0ltQSD fpgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=K39Aceok3jZzBX8IecmSIi1ldCFEPHlFJPtCSTIIQIM=; b=0ACJ+CcKMV1n+7NGPKgy9bNG/9qCGdYhqII2CHqYfZIIeF4fS/xIC4IvULFcIj+2MW MWeL1z39cgUxy1JQ1hDHneSDhxUcQ21e0atUiLtAu8S84xLG2vDMnVzyR1OtxcpVOxMM LJJY6YbdJCXo1ZZv33F8dUe9BDa9QmPrrKXLH+grFblhApfrxim04zchDahe3nOXx6lo EQbXnGg6Nf5oCIXYo0NxXt5NhPnWCMh61Wxlu/wnS23Wxm0EmxrjSaHLsiSEAwTEgATi tYYLiX63Udo908lEKiVHanc6iXV9xUbDPcFUmg1DGgOWTvAYWOrWOGerbmeoA9XZ68B6 J0fQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12-v6si1609206plt.571.2018.03.14.10.11.32; Wed, 14 Mar 2018 10:11:33 -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 S1751727AbeCNRL2 (ORCPT + 28 others); Wed, 14 Mar 2018 13:11:28 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:48465 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751449AbeCNRL1 (ORCPT ); Wed, 14 Mar 2018 13:11:27 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BBECEE2880300; Thu, 15 Mar 2018 01:11:13 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.361.1; Thu, 15 Mar 2018 01:11:05 +0800 From: John Garry To: , , , , , , , , CC: , , John Garry Subject: [PATCH] perf vendor events: fix processing for xfs Date: Thu, 15 Mar 2018 01:10:52 +0800 Message-ID: <1521047452-28565-1-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the recently introduced support for vendor subdirectory, the checking for directory entries under xfs (or any other fs which does not support dirent.d_type) is missing the check for links for current and parent directory. This can result in a broken pmu_events.c being generated. Fix this by adding the appropriate check in is_leaf_dir(). Cc: Sukadev Bhattiprolu Signed-off-by: John Garry -- 1.9.1 Tested-by: Sukadev Bhattiprolu diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 1c01844..db3a594 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -873,7 +873,10 @@ static int is_leaf_dir(const char *fpath) return 0; while ((dir = readdir(d)) != NULL) { - if (dir->d_type == DT_DIR && dir->d_name[0] != '.') { + if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")) + continue; + + if (dir->d_type == DT_DIR) { res = 0; break; } else if (dir->d_type == DT_UNKNOWN) {