Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crash_dump: use sysfs_emit in sysfs show functions

Replace sprintf() with sysfs_emit() in sysfs show functions. sysfs_emit()
is preferred for formatting sysfs output because it provides safer bounds
checking. No functional changes.

Link: https://lkml.kernel.org/r/20260301125106.911980-2-thorsten.blum@linux.dev
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Thorsten Blum and committed by
Andrew Morton
defec2ca 90c73d0b

+5 -4
+5 -4
kernel/crash_dump_dm_crypt.c
··· 6 6 #include <linux/cc_platform.h> 7 7 #include <linux/configfs.h> 8 8 #include <linux/module.h> 9 + #include <linux/sysfs.h> 9 10 10 11 #define KEY_NUM_MAX 128 /* maximum dm crypt keys */ 11 12 #define KEY_SIZE_MAX 256 /* maximum dm crypt key size */ ··· 190 189 191 190 static ssize_t config_key_description_show(struct config_item *item, char *page) 192 191 { 193 - return sprintf(page, "%s\n", to_config_key(item)->description); 192 + return sysfs_emit(page, "%s\n", to_config_key(item)->description); 194 193 } 195 194 196 195 static ssize_t config_key_description_store(struct config_item *item, ··· 266 265 267 266 static ssize_t config_keys_count_show(struct config_item *item, char *page) 268 267 { 269 - return sprintf(page, "%d\n", key_count); 268 + return sysfs_emit(page, "%d\n", key_count); 270 269 } 271 270 272 271 CONFIGFS_ATTR_RO(config_keys_, count); ··· 275 274 276 275 static ssize_t config_keys_reuse_show(struct config_item *item, char *page) 277 276 { 278 - return sprintf(page, "%d\n", is_dm_key_reused); 277 + return sysfs_emit(page, "%d\n", is_dm_key_reused); 279 278 } 280 279 281 280 static ssize_t config_keys_reuse_store(struct config_item *item, ··· 322 321 323 322 static ssize_t config_keys_restore_show(struct config_item *item, char *page) 324 323 { 325 - return sprintf(page, "%d\n", restore); 324 + return sysfs_emit(page, "%d\n", restore); 326 325 } 327 326 328 327 static ssize_t config_keys_restore_store(struct config_item *item,