powerpc/secvar: Use sysfs_emit() instead of sprintf()
authorRussell Currey <ruscur@russell.cc>
Fri, 10 Feb 2023 08:03:41 +0000 (19:03 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 12 Feb 2023 11:12:37 +0000 (22:12 +1100)
The secvar format string and object size sysfs files are both ASCII
text, and should use sysfs_emit().  No functional change.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230210080401.345462-7-ajd@linux.ibm.com
arch/powerpc/kernel/secvar-sysfs.c

index 702044e..b786d10 100644 (file)
@@ -35,7 +35,7 @@ static ssize_t format_show(struct kobject *kobj, struct kobj_attribute *attr,
        if (rc)
                goto out;
 
-       rc = sprintf(buf, "%s\n", format);
+       rc = sysfs_emit(buf, "%s\n", format);
 
 out:
        of_node_put(node);
@@ -57,7 +57,7 @@ static ssize_t size_show(struct kobject *kobj, struct kobj_attribute *attr,
                return rc;
        }
 
-       return sprintf(buf, "%llu\n", dsize);
+       return sysfs_emit(buf, "%llu\n", dsize);
 }
 
 static ssize_t data_read(struct file *filep, struct kobject *kobj,