Skip to content

Commit 9205269

Browse files
laoarpmladek
authored andcommitted
livepatch: Replace snprintf() with sysfs_emit()
Let's use sysfs_emit() instead of snprintf(). Suggested-by: Miroslav Benes <[email protected]> Signed-off-by: Yafang Shao <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Acked-by: Miroslav Benes <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Mladek <[email protected]>
1 parent 40f9caa commit 9205269

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

kernel/livepatch/core.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static ssize_t enabled_show(struct kobject *kobj,
402402
struct klp_patch *patch;
403403

404404
patch = container_of(kobj, struct klp_patch, kobj);
405-
return snprintf(buf, PAGE_SIZE-1, "%d\n", patch->enabled);
405+
return sysfs_emit(buf, "%d\n", patch->enabled);
406406
}
407407

408408
static ssize_t transition_show(struct kobject *kobj,
@@ -411,8 +411,7 @@ static ssize_t transition_show(struct kobject *kobj,
411411
struct klp_patch *patch;
412412

413413
patch = container_of(kobj, struct klp_patch, kobj);
414-
return snprintf(buf, PAGE_SIZE-1, "%d\n",
415-
patch == klp_transition_patch);
414+
return sysfs_emit(buf, "%d\n", patch == klp_transition_patch);
416415
}
417416

418417
static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,

0 commit comments

Comments
 (0)