From nobody Thu Apr 16 08:24:05 2026 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8991430B97 for ; Sun, 1 Mar 2026 12:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772369568; cv=none; b=ShuChxc22Gx9+4pYTZykMRa7uBet/J3MOAGQp3jyde5OrmYmTK3KL4RQomsxE9aqf0cJDVtZMFNMvhJbY4cY3Laqb2Yu+t5wg2ytBC7IC66H9FABPdxOhLvU7id62AVz5n8fImL9EMQmDKgIsidNlaiVFKfU9oKg1AuZaVL3WeQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772369568; c=relaxed/simple; bh=D2MQojQgF1yTTOksy8m+1gXLCZZ+uN18TIIG7ZrlMwk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OkubcJr6yUyYiHFefLsbVhg42QjJ9Q2RhCMW6uJe/yaTpj+WwlJRu82L8KVKxEKcoDHsJeBDC2ji/U8wP5cCOq7WDliIiHITfpKdmLlm4Kn1xGrsyYgyauvjCAmbr1pP8GXHRasqvnVnWtirk2WflaoLkocJRZ1fTX0Z5Hb2gVc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=LEJV/Y8a; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="LEJV/Y8a" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772369564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+5hSVLyMrqUzESvlc5APBImj2Nw/31Gm0PRLtn5Zcco=; b=LEJV/Y8a24oM1vY67p1/P5rm7FaW21JuUfIVDs/lHV7GS7tLhuFBKF5ybi+38neELJkwkG iZVMe/6ep2AsVuHMR78prPd8euR6hfHWjc6E8XnWfXy1rRVOQcnqXFnh7rvAreOo1N8/UT K7cvbSHNccR7SACF3Kgx/FD+YJkvF5w= From: Thorsten Blum To: Andrew Morton , Baoquan He , Vivek Goyal , Dave Young Cc: Thorsten Blum , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] crash_dump: use sysfs_emit in sysfs show functions Date: Sun, 1 Mar 2026 13:51:07 +0100 Message-ID: <20260301125106.911980-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Thorsten Blum Acked-by: Baoquan He --- kernel/crash_dump_dm_crypt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/crash_dump_dm_crypt.c b/kernel/crash_dump_dm_crypt.c index 1f4067fbdb94..827572aa800b 100644 --- a/kernel/crash_dump_dm_crypt.c +++ b/kernel/crash_dump_dm_crypt.c @@ -6,6 +6,7 @@ #include #include #include +#include =20 #define KEY_NUM_MAX 128 /* maximum dm crypt keys */ #define KEY_SIZE_MAX 256 /* maximum dm crypt key size */ @@ -189,7 +190,7 @@ static inline struct config_key *to_config_key(struct c= onfig_item *item) =20 static ssize_t config_key_description_show(struct config_item *item, char = *page) { - return sprintf(page, "%s\n", to_config_key(item)->description); + return sysfs_emit(page, "%s\n", to_config_key(item)->description); } =20 static ssize_t config_key_description_store(struct config_item *item, @@ -265,7 +266,7 @@ static struct config_item *config_keys_make_item(struct= config_group *group, =20 static ssize_t config_keys_count_show(struct config_item *item, char *page) { - return sprintf(page, "%d\n", key_count); + return sysfs_emit(page, "%d\n", key_count); } =20 CONFIGFS_ATTR_RO(config_keys_, count); @@ -274,7 +275,7 @@ static bool is_dm_key_reused; =20 static ssize_t config_keys_reuse_show(struct config_item *item, char *page) { - return sprintf(page, "%d\n", is_dm_key_reused); + return sysfs_emit(page, "%d\n", is_dm_key_reused); } =20 static ssize_t config_keys_reuse_store(struct config_item *item, @@ -321,7 +322,7 @@ static bool restore; =20 static ssize_t config_keys_restore_show(struct config_item *item, char *pa= ge) { - return sprintf(page, "%d\n", restore); + return sysfs_emit(page, "%d\n", restore); } =20 static ssize_t config_keys_restore_store(struct config_item *item, --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4