Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp4344466imj; Tue, 12 Feb 2019 14:17:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ6VZ9UQQFOjNuih4CtsJGhksqHd+pCnWE4kAJ1R4W/NAMeQV8h2goRUSU7RCa5lQfhomz5 X-Received: by 2002:a63:e051:: with SMTP id n17mr5722578pgj.258.1550009860078; Tue, 12 Feb 2019 14:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550009860; cv=none; d=google.com; s=arc-20160816; b=BdFPmVg4tO895ehqyl3O3G6bfdsKIB3B5gAUSD3C3kLlGpbIQnbaliEmXKWUClJbVF B1Q/yNQezWMiuEfJD7IEKyPrIhQVkUDXb+y8nuribn35ebAeG8wVdLkY1hVgyDgqvsUA TQ2yrkuxKmzybhDikPp/reXD/fPkbK4GfNt4Twr7Vamb9CMX2MetXsOnzDq1gY+ZqH24 +rcL6vtrLaAyjSfVJzfiuwLRbg/8VJnYWGUL5CQV6xM9Z3LK3eRl3Mr/tVtOmrp5jurP zOaZU1b7yn8bHFm+qdeNDFrXgp4SHU4wfB0CYY5j5oEpoZhRMkUHb8Aqe8bY4Jj6HoKG vEWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c/DP+/WPa+Jq+JAZdR/A0ANzlyTG7UQQ0eBVWCTtWwc=; b=BwfT5uD64YUE1dFdZnlOomjb+h33maIAEWXCQCf8v4RBByqNFkHxO+ETesFenlNPQC tLOsD1L/50Ojf5XSEw5K7zHoYfqXazAFvIN1qbgh7m6q1lAsP5vEvcz++t8PjN5NxsqI leFKUMlvT8OqDHXzW9YoyBUhjk+XgpZvNGKvRnzFXgSiViiVKYXmTapIE8iyOCiYN/7w fnL1YutETexm4alYvGe149RB3s9UvrPp9hBS24QfN6Fza+Ocj40590nj4uh31q+FqaHf mm/tUI2fKEjoB8DvpwtAnCx2CsvBXh/MpbZVgIVMMMlDWEUCMjU4oc6DkF9ZCs1/OI+s 0qFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=iSZ2ZAQI; 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 f128si12617637pfb.30.2019.02.12.14.17.24; Tue, 12 Feb 2019 14:17:40 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=iSZ2ZAQI; 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 S1731738AbfBLVmH (ORCPT + 99 others); Tue, 12 Feb 2019 16:42:07 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43081 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731057AbfBLVmF (ORCPT ); Tue, 12 Feb 2019 16:42:05 -0500 Received: by mail-ed1-f68.google.com with SMTP id f9so146660eds.10 for ; Tue, 12 Feb 2019 13:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=c/DP+/WPa+Jq+JAZdR/A0ANzlyTG7UQQ0eBVWCTtWwc=; b=iSZ2ZAQIrQiu4zvswrqxRbv/hOc15iZsZHSIg0qRcuB7IlbKMG8RWvp+MgAUlw7VOo VSzLPYMyKNl873vKJOyKjjodhd/QC3DaAgrIE8m4UPnreR5SYyA8sn8puWcD8mvxSFSS yVIeIuKbBGx6/r/lyrPdmGoLzAY13QaB5xy0M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c/DP+/WPa+Jq+JAZdR/A0ANzlyTG7UQQ0eBVWCTtWwc=; b=XcGEFptonzj1JxdBgwlSfpKDFs3WRnGNJnBgpiR3Hhac8TFK04WFaLrz0gzGgmV9W/ zHaO/S63AlFGIsHZdn2XpZeFyI444njKEqTrJJ5SvUBFH3hJtTCttMUpClskdOd0U++V CcYQ820stYwI6N1pzmQHf3jLUv3vC5J7icWD24uVQNVinV79k/COJYG4dInn2pJO1fXB pl1pYdU09Axm5IUeeDK9QOHm5lX3/yVoSzRW+o0X9LaGvDaET/WAb7K7/mWRaVu4HgQg OHKJ2cyNl0shzuk43PZqNn55yWyZlbEI3pzHNb7G0zf5pNiD8vzNcZSpILUoV5GPdSh6 BUjw== X-Gm-Message-State: AHQUAubQUBEuR6mlDKaDw4npipPdDYwBNDLw7Re0kXjqDUp+Mi/fZPQB lIoQHst1gfK4HLbzNQPLASXk5g== X-Received: by 2002:a17:906:4306:: with SMTP id j6mr4229872ejm.174.1550007723363; Tue, 12 Feb 2019 13:42:03 -0800 (PST) Received: from prevas-ravi.waoo.dk (ip-5-186-119-174.cgn.fibianet.dk. [5.186.119.174]) by smtp.gmail.com with ESMTPSA id v1sm3697607eds.47.2019.02.12.13.42.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 13:42:02 -0800 (PST) From: Rasmus Villemoes To: Andrew Morton , Jason Baron Cc: linux-kernel@vger.kernel.org, Rasmus Villemoes Subject: [PATCH v4 06/14] dynamic_debug: use pointer comparison in ddebug_remove_module Date: Tue, 12 Feb 2019 22:41:42 +0100 Message-Id: <20190212214150.4807-7-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190212214150.4807-1-linux@rasmusvillemoes.dk> References: <20190212214150.4807-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we store the passed-in string directly in ddebug_add_module, we can use pointer equality instead of strcmp. This is a little more efficient, but more importantly, this also makes the code somewhat more correct: Currently, if one loads and then unloads a module whose name happens to match the KBUILD_MODNAME of some built-in functionality (which need not even be modular at all), all of their dynamic debug entries vanish along with those of the actual module. For example, loading and unloading a core.ko hides all pr_debugs from drivers/base/core.c and other built-in files called core.c (incidentally, there is an in-tree module whose name is core, but I just tested this with an out-of-tree trivial one). Acked-by: Jason Baron Signed-off-by: Rasmus Villemoes --- lib/dynamic_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 8274c4ea75e0..214828c65625 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -929,9 +929,10 @@ int ddebug_remove_module(const char *mod_name) mutex_lock(&ddebug_lock); list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) { - if (!strcmp(dt->mod_name, mod_name)) { + if (dt->mod_name == mod_name) { ddebug_table_free(dt); ret = 0; + break; } } mutex_unlock(&ddebug_lock); -- 2.20.1