mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:08:54 +00:00
c50262498d
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>
24 lines
717 B
C
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");
|
|
}
|