Message ID | cover.1695403360.git.christophe.jaillet@wanadoo.fr |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5759890vqi; Fri, 22 Sep 2023 10:42:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLX6QAoWH5dHLjronOV+M2xJo3DmDAz5PKNWE+/5sSaP1f/lhydJTaf9UDj1aVNaUGcp+v X-Received: by 2002:a17:902:b7cb:b0:1bd:ca80:6fe6 with SMTP id v11-20020a170902b7cb00b001bdca806fe6mr116074plz.41.1695404540748; Fri, 22 Sep 2023 10:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695404540; cv=none; d=google.com; s=arc-20160816; b=Ppjo4pdYqH85Bizwqdwc9svAx+fkfpW752UaJmfRsyOj8ChXVkdIj00PkxtyXbkB9w 8yIUG5aGgFJAQj6rivCq/Ay4XyI9CbXoh1F4FzkpyXERSVhgfCcTWGX8WgSukO8WeaNj J7HbFWlOvymMDxePPmwxtBoEZEMLUpuXUAcUY8mK3oNgPu4KLN93Tg7WkGkqlt/LjvY3 aVRzgUYi9Il6d+xWjcUxmvC8Y1RJM6L00tzy295Ot6y6KOjKH9P6svTG3HcZLmlYYxXA HdkMUvjKQfOHSZJ9o6jaLdoiwotKEXiJ8qrfX0A4UJZ8h0d3/PAZJNe44nH81c1FAlIP 8wdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=0c+1nrtaYzzyJr/TMUP01Cfy/oTbrxiF1JN1eoAupD0=; fh=uXwYueyGEtDvu2ZbSKCnzskpCZEFEodi6FsZqrzIgUI=; b=oh5NVia+BiMPwftilVUGcIio23Jb9IPIW/wEOiWTo0BShgcY/Ec1mK7ADSjXUsFT8x i6wPvG3ENqp1LIYLN8TPK36xuINxzGPs5tyGd3oo3Gvy7rUTYt+ru6c9FroUS8BsP5jX 5sG5P9S14KitrvIIzt2dvlAPIqNian/x6nrJxf7oq1cWoH6u7do/YzUxDRSvNjqmlMBv U5w5rv7WhTj9jgUYsoQJlP3lf4dkazrvexS2KoI+8+iBgTJ9Ji0WicD2FBw0pACppPUu hALcHqIenad63+L+wBX6XZVJ7dn5IgA5qQlOuTPpWPAPl9GL8P7J0iZQa/FRdAMtSXow AGhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wanadoo.fr header.s=t20230301 header.b=FoJEE5rS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x15-20020a170902a38f00b001bbc066c626si4020543pla.428.2023.09.22.10.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 10:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=fail header.i=@wanadoo.fr header.s=t20230301 header.b=FoJEE5rS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 694C781ADB60; Fri, 22 Sep 2023 10:32:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbjIVRcP (ORCPT <rfc822;pwkd43@gmail.com> + 28 others); Fri, 22 Sep 2023 13:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231803AbjIVRcA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 22 Sep 2023 13:32:00 -0400 Received: from smtp.smtpout.orange.fr (smtp-15.smtpout.orange.fr [80.12.242.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BBBBCCA for <linux-kernel@vger.kernel.org>; Fri, 22 Sep 2023 10:31:15 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id jjzlq1mvsWkeLjjzlquvzJ; Fri, 22 Sep 2023 19:31:13 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1695403873; bh=0c+1nrtaYzzyJr/TMUP01Cfy/oTbrxiF1JN1eoAupD0=; h=From:To:Cc:Subject:Date; b=FoJEE5rScCw656R799hUGXQbCc58OWjIa5E8OZvqmu6yTdTIQQhNJUyZKtGbJahLj uGzKNhw2pvojdCk1iB0lsqaf59t160v76sLLD7JIoDichUPuLplCYAc9iTMSgfBkhk VXxnBjUqMaNNu5BH75vVfaovAz9m5EAS9EDxpJ3h3GZr4IthvKlZpSzuD6SL9FLbRn n+T3HtE0AwUzD56cY/K5qxOY7cUCwwgz9Ij7yqJECG65djgye7BdOXRMQIChjXrZ/4 p1aGiDCGlFekZW3M0xGCc8cTEh6Cfh97Daz20o2ZdOqwBjf/JRaWH8whK34h2tqYnC 2zwEcPXPMRB6g== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 22 Sep 2023 19:31:13 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET <christophe.jaillet@wanadoo.fr> Subject: [PATCH 0/3] fs: dlm: Fix some issues related to a buffer in dlm_create_debug_file() Date: Fri, 22 Sep 2023 19:31:07 +0200 Message-Id: <cover.1695403360.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 22 Sep 2023 10:32:22 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777760511473605443 X-GMAIL-MSGID: 1777760511473605443 |
Series |
fs: dlm: Fix some issues related to a buffer in dlm_create_debug_file()
|
|
Message
Christophe JAILLET
Sept. 22, 2023, 5:31 p.m. UTC
The goal of this serie is to remove a warning when building with W=1. (details in patch 2) Patch 1 is a preparation step. It is a no-op. The generated code is the same. Patch 2 is the real fix. Patch 3 is an additionnal clean-up. Christophe JAILLET (3): fs: dlm: Simplify buffer size computation in dlm_create_debug_file() fs: dlm: Fix the size of a buffer in dlm_create_debug_file() fs: dlm: Remove some useless memset() fs/dlm/debug_fs.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
Comments
Hi, On Fri, Sep 22, 2023 at 1:38 PM Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote: > > 8 is not the maximum size of the suffix used when creating debugfs files. > > Let the compiler compute the correct size, and only give a hint about the > longest possible string that is used. > > When building with W=1, this fixes the following warnings: > > fs/dlm/debug_fs.c: In function ‘dlm_create_debug_file’: > fs/dlm/debug_fs.c:1020:58: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] > 1020 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name); > | ^ > fs/dlm/debug_fs.c:1020:9: note: ‘snprintf’ output between 9 and 73 bytes into a destination of size 72 > 1020 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > fs/dlm/debug_fs.c:1031:50: error: ‘_queued_asts’ directive output may be truncated writing 12 bytes into a region of size between 8 and 72 [-Werror=format-truncation=] > 1031 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name); > | ^~~~~~~~~~~~ > fs/dlm/debug_fs.c:1031:9: note: ‘snprintf’ output between 13 and 77 bytes into a destination of size 72 > 1031 | snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Fixes: 541adb0d4d10b ("fs: dlm: debugfs for queued callbacks") > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> there is a similar patch [0] already in the queue for dlm. - Alex [0] https://lore.kernel.org/gfs2/20230906143153.1353077-5-aahringo@redhat.com/T/#u