From nobody Tue Dec 16 12:38:52 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AD5BCD4846 for ; Fri, 22 Sep 2023 17:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232542AbjIVRcT (ORCPT ); Fri, 22 Sep 2023 13:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232987AbjIVRcC (ORCPT ); Fri, 22 Sep 2023 13:32:02 -0400 Received: from smtp.smtpout.orange.fr (smtp-16.smtpout.orange.fr [80.12.242.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A981CE8 for ; Fri, 22 Sep 2023 10:31:21 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id jjzlq1mvsWkeLjjzrquw0f; Fri, 22 Sep 2023 19:31:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1695403880; bh=yYjSmcx/VJZzuw1p6UKG5+Hy8jnYhRHiCAv+RVTuQck=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FlRxA+cj4yYQbUj6Il4dYJ2mbY0GguoV1mtN4/JI7AGuCZGLsyG7qy3Roc5/+MGv/ 3lGZPO7tzfakC/zroQzviKunsqS5oHuKjaMj24vZ3mndkrzLlahLUhO80U5KHTtpIg qCmUzt1Qxd8z96R1DeQWzZl44wYgPytHlVkrTNOubzHXWxsnQ9kkeNEhUNuwMIjTXP 4TS4dHIUiEIymyMOtnKKMJDf0P6MG+6PjfmR5SlkivJR+QWD8Omac/o7m8/Y8s1Nl+ Ercowm17JP8keVgYPC+aKYAvIYCtaisrsBerhLcv49ZqWe1/iWUOlqxXbdMWNAeb2G 7wbjRjhOsCOIQ== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 22 Sep 2023 19:31:20 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Christine Caulfield , David Teigland Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , gfs2@lists.linux.dev Subject: [PATCH 1/3] fs: dlm: Simplify buffer size computation in dlm_create_debug_file() Date: Fri, 22 Sep 2023 19:31:08 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use sizeof(name) instead of the equivalent, but hard coded, DLM_LOCKSPACE_LEN + 8. This is less verbose and more future proof. Signed-off-by: Christophe JAILLET --- fs/dlm/debug_fs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c index 5aabcb6f0f15..e9726c6cbdf2 100644 --- a/fs/dlm/debug_fs.c +++ b/fs/dlm/debug_fs.c @@ -986,7 +986,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) /* format 2 */ =20 memset(name, 0, sizeof(name)); - snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_locks", ls->ls_name); + snprintf(name, sizeof(name), "%s_locks", ls->ls_name); =20 ls->ls_debug_locks_dentry =3D debugfs_create_file(name, 0644, @@ -997,7 +997,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) /* format 3 */ =20 memset(name, 0, sizeof(name)); - snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_all", ls->ls_name); + snprintf(name, sizeof(name), "%s_all", ls->ls_name); =20 ls->ls_debug_all_dentry =3D debugfs_create_file(name, S_IFREG | S_IRUGO, @@ -1008,7 +1008,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) /* format 4 */ =20 memset(name, 0, sizeof(name)); - snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_toss", ls->ls_name); + snprintf(name, sizeof(name), "%s_toss", ls->ls_name); =20 ls->ls_debug_toss_dentry =3D debugfs_create_file(name, S_IFREG | S_IRUGO, @@ -1017,7 +1017,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) &format4_fops); =20 memset(name, 0, sizeof(name)); - snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name); + snprintf(name, sizeof(name), "%s_waiters", ls->ls_name); =20 ls->ls_debug_waiters_dentry =3D debugfs_create_file(name, 0644, @@ -1028,7 +1028,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) /* format 5 */ =20 memset(name, 0, sizeof(name)); - snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name); + snprintf(name, sizeof(name), "%s_queued_asts", ls->ls_name); =20 ls->ls_debug_queued_asts_dentry =3D debugfs_create_file(name, 0644, --=20 2.34.1