Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mcb: use sysfs_emit_at() instead of scnprintf() in show functions

This change improves clarity and ensures proper bounds checking in
line with the preferred sysfs_emit() API usage for sysfs 'show'
functions. The PAGE_SIZE check is now handled internally by the helper.

No functional change intended.

Signed-off-by: Abhinav Ananthu <abhinav.ogl@gmail.com>
Signed-off-by: Johannes Thumshirn <jth@kernel.org>
Reviewed-by: Johannes Thumshirn <jth@kernel.org>
Link: https://lore.kernel.org/r/20250707074720.40051-2-jth@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Abhinav Ananthu and committed by
Greg Kroah-Hartman
77e49c35 d1934ed9

+4 -4
+4 -4
drivers/mcb/mcb-core.c
··· 107 107 { 108 108 struct mcb_bus *bus = to_mcb_bus(dev); 109 109 110 - return scnprintf(buf, PAGE_SIZE, "%d\n", bus->revision); 110 + return sysfs_emit(buf, "%d\n", bus->revision); 111 111 } 112 112 static DEVICE_ATTR_RO(revision); 113 113 ··· 116 116 { 117 117 struct mcb_bus *bus = to_mcb_bus(dev); 118 118 119 - return scnprintf(buf, PAGE_SIZE, "%c\n", bus->model); 119 + return sysfs_emit(buf, "%c\n", bus->model); 120 120 } 121 121 static DEVICE_ATTR_RO(model); 122 122 ··· 125 125 { 126 126 struct mcb_bus *bus = to_mcb_bus(dev); 127 127 128 - return scnprintf(buf, PAGE_SIZE, "%d\n", bus->minor); 128 + return sysfs_emit(buf, "%d\n", bus->minor); 129 129 } 130 130 static DEVICE_ATTR_RO(minor); 131 131 ··· 134 134 { 135 135 struct mcb_bus *bus = to_mcb_bus(dev); 136 136 137 - return scnprintf(buf, PAGE_SIZE, "%s\n", bus->name); 137 + return sysfs_emit(buf, "%s\n", bus->name); 138 138 } 139 139 static DEVICE_ATTR_RO(name); 140 140