]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/nospec: Switch over to sysfs_emit()
authorMete Durlu <meted@linux.ibm.com>
Wed, 23 Oct 2024 12:10:58 +0000 (14:10 +0200)
committerHeiko Carstens <hca@linux.ibm.com>
Fri, 25 Oct 2024 14:03:24 +0000 (16:03 +0200)
Per Documentation/filesystems/sysfs.rst, sysfs_emit() is preferred over
sprintf for presenting attributes to user space. Convert the left-over
uses in the s390/nospec-sysfs code.

Signed-off-by: Mete Durlu <meted@linux.ibm.com>
Reviewed-by: Gerd Bayer <gbayer@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/nospec-sysfs.c

index a951888186370ddb7c72c8db34e91269997c9e45..5970dd3ee7c5ada276e8407cc7bc7db382581840 100644 (file)
@@ -7,17 +7,17 @@
 ssize_t cpu_show_spectre_v1(struct device *dev,
                            struct device_attribute *attr, char *buf)
 {
-       return sprintf(buf, "Mitigation: __user pointer sanitization\n");
+       return sysfs_emit(buf, "Mitigation: __user pointer sanitization\n");
 }
 
 ssize_t cpu_show_spectre_v2(struct device *dev,
                            struct device_attribute *attr, char *buf)
 {
        if (test_facility(156))
-               return sprintf(buf, "Mitigation: etokens\n");
+               return sysfs_emit(buf, "Mitigation: etokens\n");
        if (nospec_uses_trampoline())
-               return sprintf(buf, "Mitigation: execute trampolines\n");
+               return sysfs_emit(buf, "Mitigation: execute trampolines\n");
        if (nobp_enabled())
-               return sprintf(buf, "Mitigation: limited branch prediction\n");
-       return sprintf(buf, "Vulnerable\n");
+               return sysfs_emit(buf, "Mitigation: limited branch prediction\n");
+       return sysfs_emit(buf, "Vulnerable\n");
 }