samples/kobject: Use sysfs_emit instead of sprintf
authorNguyen Dinh Phi <phind.uet@gmail.com>
Thu, 3 Mar 2022 18:36:18 +0000 (02:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Mar 2022 13:28:29 +0000 (14:28 +0100)
commit5a242d8547bdc5802d1e1200a85e69afc3c2d74e
treeeb14bd2ddfab55b9f3c2305477fc8c2b4e74417a
parentb0f6807d35667faae6de5e23ceffa4546c209bc8
samples/kobject: Use sysfs_emit instead of sprintf

sysfs_emit() is preferred over sprintf() when formatting the value to be
returned to user space in show() functions, because it knows about sysfs
buffer specifics and has sanity checks.

Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Link: https://lore.kernel.org/r/20220303183618.1342358-1-phind.uet@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
samples/kobject/kobject-example.c
samples/kobject/kset-example.c