From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (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 88E2F3806C7 for ; Thu, 26 Feb 2026 12:30:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772109025; cv=none; b=IxXQYNUILeI+uUZBxNjZCr5MF8H3nSe3uLwCls89DBM2Huw73JUkYQ1uBK/1xyEerZH6RIvvE+I7kbWzI3cK44YTtCf9BjfcQ+wT0TVy4u5skJeL8P0pT3qgQBMRN+2vLPJ3uRmN3RP8Uyovfzu0l0hYyBU9jA1MZt+cL/Ef7pM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772109025; c=relaxed/simple; bh=XNrS3VgVrsCUPvUqQwTo07hrsSQLF3VdJSaw+URyKPI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=vEBi0Qrax/QHgRHs1ngnYR2vMqrQVBS2V6VjH1RfeZZDFEKrnsC9rYBIc0UWWyYEU9640Sft9uvIfLpg9MHku1eiIGSACAtRw/XDuDwCBi5V0YVV8fofnyn9cYJAlHf7dZQW4J15jlTEQHfjIWOiN/NVHsCNKEK88U5rG1aJ0OI= 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=o/EM/ffo; arc=none smtp.client-ip=95.215.58.181 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="o/EM/ffo" 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=1772109020; 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=g4jAKiNC4buyNBIVXO5beSLmNwoDMCzyWZpMHat9RCE=; b=o/EM/ffoNpfGoAGReLhLL9EVkZgJYuAeHP0BaqTSgR0qfpzk0S51uSssx3fQlLxvsYvqbd DAUNjKTLzx35Uq04p2qdWoCaCNNgV5nBMVxAHlVOI9qhWCmSD5QEVSxhSaJSGW2Dr9tGwg zyqh0x+JduIq5cZWT7BYz6gBx4XjT78= From: Thorsten Blum To: Parthiban Veerasooran , Christian Gromm Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH] most: configfs: Use sysfs_emit in sysfs show functions Date: Thu, 26 Feb 2026 13:28:48 +0100 Message-ID: <20260226122847.737286-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: 8bit X-Migadu-Flow: FLOW_OUT Replace snprintf() with sysfs_emit() in sysfs show functions, which is preferred for formatting sysfs output because it provides safer bounds checking. No functional changes. Signed-off-by: Thorsten Blum --- drivers/most/configfs.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/most/configfs.c b/drivers/most/configfs.c index 8f5158d95bc3..f2aae6874b64 100644 --- a/drivers/most/configfs.c +++ b/drivers/most/configfs.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include #include +#include #include #include #include @@ -159,7 +160,7 @@ static ssize_t mdev_link_destroy_link_store(struct config_item *item, static ssize_t mdev_link_direction_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->direction); + return sysfs_emit(page, "%s\n", to_mdev_link(item)->direction); } static ssize_t mdev_link_direction_store(struct config_item *item, @@ -177,7 +178,7 @@ static ssize_t mdev_link_direction_store(struct config_item *item, static ssize_t mdev_link_datatype_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->datatype); + return sysfs_emit(page, "%s\n", to_mdev_link(item)->datatype); } static ssize_t mdev_link_datatype_store(struct config_item *item, @@ -196,7 +197,7 @@ static ssize_t mdev_link_datatype_store(struct config_item *item, static ssize_t mdev_link_device_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->device); + return sysfs_emit(page, "%s\n", to_mdev_link(item)->device); } static ssize_t mdev_link_device_store(struct config_item *item, @@ -211,7 +212,7 @@ static ssize_t mdev_link_device_store(struct config_item *item, static ssize_t mdev_link_channel_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->channel); + return sysfs_emit(page, "%s\n", to_mdev_link(item)->channel); } static ssize_t mdev_link_channel_store(struct config_item *item, @@ -226,7 +227,7 @@ static ssize_t mdev_link_channel_store(struct config_item *item, static ssize_t mdev_link_comp_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%s\n", to_mdev_link(item)->comp); + return sysfs_emit(page, "%s\n", to_mdev_link(item)->comp); } static ssize_t mdev_link_comp_store(struct config_item *item, @@ -241,8 +242,7 @@ static ssize_t mdev_link_comp_store(struct config_item *item, static ssize_t mdev_link_comp_params_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%s\n", - to_mdev_link(item)->comp_params); + return sysfs_emit(page, "%s\n", to_mdev_link(item)->comp_params); } static ssize_t mdev_link_comp_params_store(struct config_item *item, @@ -257,8 +257,7 @@ static ssize_t mdev_link_comp_params_store(struct config_item *item, static ssize_t mdev_link_num_buffers_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", - to_mdev_link(item)->num_buffers); + return sysfs_emit(page, "%d\n", to_mdev_link(item)->num_buffers); } static ssize_t mdev_link_num_buffers_store(struct config_item *item, @@ -275,8 +274,7 @@ static ssize_t mdev_link_num_buffers_store(struct config_item *item, static ssize_t mdev_link_buffer_size_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", - to_mdev_link(item)->buffer_size); + return sysfs_emit(page, "%d\n", to_mdev_link(item)->buffer_size); } static ssize_t mdev_link_buffer_size_store(struct config_item *item, @@ -294,8 +292,7 @@ static ssize_t mdev_link_buffer_size_store(struct config_item *item, static ssize_t mdev_link_subbuffer_size_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", - to_mdev_link(item)->subbuffer_size); + return sysfs_emit(page, "%d\n", to_mdev_link(item)->subbuffer_size); } static ssize_t mdev_link_subbuffer_size_store(struct config_item *item, @@ -313,8 +310,7 @@ static ssize_t mdev_link_subbuffer_size_store(struct config_item *item, static ssize_t mdev_link_packets_per_xact_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", - to_mdev_link(item)->packets_per_xact); + return sysfs_emit(page, "%d\n", to_mdev_link(item)->packets_per_xact); } static ssize_t mdev_link_packets_per_xact_store(struct config_item *item, @@ -331,7 +327,7 @@ static ssize_t mdev_link_packets_per_xact_store(struct config_item *item, static ssize_t mdev_link_dbr_size_show(struct config_item *item, char *page) { - return snprintf(page, PAGE_SIZE, "%d\n", to_mdev_link(item)->dbr_size); + return sysfs_emit(page, "%d\n", to_mdev_link(item)->dbr_size); } static ssize_t mdev_link_dbr_size_store(struct config_item *item, -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4