linux/arch/s390/kernel/nospec-sysfs.c
Mete Durlu c50262498d s390/nospec: Switch over to sysfs_emit()
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>
2024-10-25 16:03:24 +02:00

24 lines
717 B
C

// SPDX-License-Identifier: GPL-2.0
#include <linux/device.h>
#include <linux/cpu.h>
#include <asm/facility.h>
#include <asm/nospec-branch.h>
ssize_t cpu_show_spectre_v1(struct device *dev,
struct device_attribute *attr, char *buf)
{
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 sysfs_emit(buf, "Mitigation: etokens\n");
if (nospec_uses_trampoline())
return sysfs_emit(buf, "Mitigation: execute trampolines\n");
if (nobp_enabled())
return sysfs_emit(buf, "Mitigation: limited branch prediction\n");
return sysfs_emit(buf, "Vulnerable\n");
}