lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 25 Apr 2022 10:41:49 +0800
From:   Ren Zhijie <renzhijie2@...wei.com>
To:     <gregkh@...uxfoundation.org>, <rafael@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, Ren Zhijie <renzhijie2@...wei.com>
Subject: [PATCH -next] base: topology: fix unused variable compile error

compile error:
drivers/base/topology.c: In function ‘topology_is_visible’:
drivers/base/topology.c:158:17: error: unused variable ‘dev’ [-Werror=unused-variable]
  struct device *dev = kobj_to_dev(kobj);
                 ^~~
cc1: all warnings being treated as errors

If CONFIG_SMP is N, the macro 'topology_ppin()'expands as follows.
"topology_ppin(dev->id) -> boot_cpu_data.ppin"
This cause an unused variable warning for 'dev' which used in the
topology_is_visible().

To fix build warning unused attribute added to the 'dev' variable.

Reported-by: Hulk Robot <hulkci@...wei.com>
Fixes:aa63a74d4535("topology/sysfs: Hide PPIN on systems that do not support it.")
Signed-off-by: Ren Zhijie <renzhijie2@...wei.com>
---
 drivers/base/topology.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/topology.c b/drivers/base/topology.c
index 706dbf8bf249..70962a4bcb1f 100644
--- a/drivers/base/topology.c
+++ b/drivers/base/topology.c
@@ -155,7 +155,8 @@ static struct attribute *default_attrs[] = {
 static umode_t topology_is_visible(struct kobject *kobj,
 				   struct attribute *attr, int unused)
 {
-	struct device *dev = kobj_to_dev(kobj);
+	struct device *dev __maybe_unused;

+	dev = kobj_to_dev(kobj);
 
 	if (attr == &dev_attr_ppin.attr && !topology_ppin(dev->id))
 		return 0;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ