At least dmi_scan.c fails to compile:
../drivers/firmware/dmi_scan.c:764:8: error: use of undeclared identifier 'sysfs_bin_attr_simple_read'
764 | static BIN_ATTR_SIMPLE_ADMIN_RO(smbios_entry_point);
| ^
../include/linux/sysfs.h:383:41: note: expanded from macro 'BIN_ATTR_SIMPLE_ADMIN_RO'
383 | struct bin_attribute bin_attr_##_name = __BIN_ATTR_SIMPLE_RO(_name, 0400)
| ^
../include/linux/sysfs.h:376:10: note: expanded from macro '__BIN_ATTR_SIMPLE_RO'
376 | .read = sysfs_bin_attr_simple_read, \
| ^
../drivers/firmware/dmi_scan.c:765:8: error: use of undeclared identifier 'sysfs_bin_attr_simple_read'
765 | static BIN_ATTR_SIMPLE_ADMIN_RO(DMI);
| ^
../include/linux/sysfs.h:383:41: note: expanded from macro 'BIN_ATTR_SIMPLE_ADMIN_RO'
383 | struct bin_attribute bin_attr_##_name = __BIN_ATTR_SIMPLE_RO(_name, 0400)
| ^
../include/linux/sysfs.h:376:10: note: expanded from macro '__BIN_ATTR_SIMPLE_RO'
376 | .read = sysfs_bin_attr_simple_read, \
| ^
Since the only declaration for sysfs_bin_attr_simple_read() is inside the
"#ifdef CONFIG_SYSFS". Add a stub to the #else section too.
Fixes: d48c03198a92 ("sysfs: Add sysfs_bin_attr_simple_read() helper")
Signed-off-by: Jason Gunthorpe <[email protected]>
---
include/linux/sysfs.h | 9 +++++++++
1 file changed, 9 insertions(+)
I don't see a patch for this yet, but I did find a 0-day robot complaint:
https://lore.kernel.org/all/[email protected]/
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index a7d725fbf73937..e672a927d650a3 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -750,6 +750,15 @@ static inline int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
{
return 0;
}
+
+static inline ssize_t sysfs_bin_attr_simple_read(struct file *file,
+ struct kobject *kobj,
+ struct bin_attribute *attr,
+ char *buf, loff_t off,
+ size_t count)
+{
+ return -EINVAL;
+}
#endif /* CONFIG_SYSFS */
static inline int __must_check sysfs_create_file(struct kobject *kobj,
base-commit: c58a77fe0ba1b708759338ad8bd3828b75a26035
--
2.45.2
On Mon, Jun 03, 2024 at 02:30:45PM -0300, Jason Gunthorpe wrote:
> Since the only declaration for sysfs_bin_attr_simple_read() is inside the
> "#ifdef CONFIG_SYSFS". Add a stub to the #else section too.
[...]
> I don't see a patch for this yet, but I did find a 0-day robot complaint:
>
> https://lore.kernel.org/all/[email protected]/
I already submitted a patch on May 23, but it hasn't been applied yet:
https://lore.kernel.org/all/05f4290439a58730738a15b0c99cd8576c4aa0d9.1716461752.git.lukas@wunner.de/
(My patch returns 0, yours -EINVAL, but I don't think that matters.)
Thanks (and sorry for the breakage)!
Lukas
On Mon, Jun 03, 2024 at 10:46:34PM +0200, Lukas Wunner wrote:
> On Mon, Jun 03, 2024 at 02:30:45PM -0300, Jason Gunthorpe wrote:
> > Since the only declaration for sysfs_bin_attr_simple_read() is inside the
> > "#ifdef CONFIG_SYSFS". Add a stub to the #else section too.
> [...]
> > I don't see a patch for this yet, but I did find a 0-day robot complaint:
> >
> > https://lore.kernel.org/all/[email protected]/
>
> I already submitted a patch on May 23, but it hasn't been applied yet:
>
> https://lore.kernel.org/all/05f4290439a58730738a15b0c99cd8576c4aa0d9.1716461752.git.lukas@wunner.de/
Ah, it is not a good practice to put patches you want applied buried
in a thread, that is perhaps why it has been overlooked..
> (My patch returns 0, yours -EINVAL, but I don't think that matters.)
Yes, it looks like the function will never be called.
Jason