Re: [PATCH v3 5/6] s390/uv: replace scnprintf with sysfs_emit

Janosch Frank
2023-06-06T13:50:34Z

On 6/6/23 13:37, Steffen Eiden wrote:
> Replace scnprintf(page, PAGE_SIZE, ...) with the page size aware
> sysfs_emit(buf, ...) which adds some sanity checks.
>
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
> arch/s390/kernel/uv.c | 54 +++++++++++++++++++------------------------
> 1 file changed, 24 insertions(+), 30 deletions(-)
>
> diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
> index cb2ee06df286..cd3a591edab3 100644
> --- a/arch/s390/kernel/uv.c
> +++ b/arch/s390/kernel/uv.c
> @@ -460,13 +460,13 @@ EXPORT_SYMBOL_GPL(arch_make_page_accessible);

> static struct kobj_attribute uv_query_supp_att_pflags_attr =
> @@ -605,7 +599,7 @@ static ssize_t uv_is_prot_virt_guest(struct kobject *kobj,
> #ifdef CONFIG_PROTECTED_VIRTUALIZATION_GUEST
> val = prot_virt_guest;
> #endif
> - return scnprintf(page, PAGE_SIZE, "%d\n", val);
> + return sysfs_emit(page, "%d\n", val);
> }
>
> static ssize_t uv_is_prot_virt_host(struct kobject *kobj,
> @@ -617,7 +611,7 @@ static ssize_t uv_is_prot_virt_host(struct kobject *kobj,
> val = prot_virt_host;
> #endif
>
> - return scnprintf(page, PAGE_SIZE, "%d\n", val);
> + return sysfs_emit(page, "%d\n", val);
> }

These are still named page