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]
Message-ID: <20200302092918.40163-1-yaohongbo@huawei.com>
Date:   Mon, 2 Mar 2020 17:29:18 +0800
From:   Hongbo Yao <yaohongbo@...wei.com>
To:     <gregkh@...uxfoundation.org>, <christian.brauner@...ntu.com>
CC:     <linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>,
        <yaohongbo@...wei.com>, <chenzhou10@...wei.com>,
        <rjw@...ysocki.net>, <pavel@....cz>
Subject: [PATCH -next] drivers/base/power: fix build error without SYSFS

If CONFIG_SYSFS=n, the following error is seen while building 
drivers/base/power/sysfs.c:

drivers/base/power/sysfs.c: In function dpm_sysfs_change_owner:
drivers/base/power/sysfs.c:708:44: error: passing argument 2 of
sysfs_group_change_owner from incompatible pointer type
[-Werror=incompatible-pointer-types]
  rc = sysfs_group_change_owner(&dev->kobj, &pm_attr_group, kuid, kgid);
                                            ^
In file included from ./include/linux/kobject.h:20:0,
                 from ./include/linux/device.h:17,
                 from drivers/base/power/sysfs.c:3:
./include/linux/sysfs.h:564:19: note: expected const struct
attribute_group ** but argument is of type const struct attribute_group *

dpm_sysfs_change_owner() should only used when CONFIG_SYSFS is
defined.

Reported-by: Hulk Robot <hulkci@...wei.com>
Fixes: 3b52fc5d7876 ("drivers/base/power: add dpm_sysfs_change_owner()")
Signed-off-by: Hongbo Yao <yaohongbo@...wei.com>
---
 drivers/base/power/power.h | 10 +++++++++-
 drivers/base/power/sysfs.c |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h
index 54292cdd7808..4bd88f696be9 100644
--- a/drivers/base/power/power.h
+++ b/drivers/base/power/power.h
@@ -74,7 +74,6 @@ extern int pm_qos_sysfs_add_flags(struct device *dev);
 extern void pm_qos_sysfs_remove_flags(struct device *dev);
 extern int pm_qos_sysfs_add_latency_tolerance(struct device *dev);
 extern void pm_qos_sysfs_remove_latency_tolerance(struct device *dev);
-extern int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
 
 #else /* CONFIG_PM */
 
@@ -89,6 +88,15 @@ static inline void pm_runtime_remove(struct device *dev) {}
 
 static inline int dpm_sysfs_add(struct device *dev) { return 0; }
 static inline void dpm_sysfs_remove(struct device *dev) {}
+
+#endif
+
+#if defined(CONFIG_PM) && defined(CONFIG_SYSFS)
+
+extern int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid);
+
+#else
+
 static inline int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid,
 					 kgid_t kgid) { return 0; }
 
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 2b99fe1eb207..d6749f374ded 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -698,6 +698,7 @@ int dpm_sysfs_add(struct device *dev)
 	return rc;
 }
 
+#ifdef CONFIG_SYSFS
 int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
 {
 	int rc;
@@ -736,6 +737,7 @@ int dpm_sysfs_change_owner(struct device *dev, kuid_t kuid, kgid_t kgid)
 	}
 	return 0;
 }
+#endif
 
 int wakeup_sysfs_add(struct device *dev)
 {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ