[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251222111530.c285692e5872035d6ee68264@linux-foundation.org>
Date: Mon, 22 Dec 2025 11:15:30 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Xiu Jianfeng <xiujianfeng@...weicloud.com>
Cc: muchun.song@...ux.dev, osalvador@...e.de, david@...nel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] mm/hugetlb_cgroup: fix -Wformat-truncation
warning
On Mon, 22 Dec 2025 07:23:59 +0000 Xiu Jianfeng <xiujianfeng@...weicloud.com> wrote:
> A false-positive compile warnings with -Wformat-trucation was introduced
> by commit 47179fe03588 ("mm/hugetlb_cgroup: prepare cftypes based
> on template") on arch s390. Suppress it by replacing snprintf() with
> scnprintf().
Thanks.
Let's quote that error message in the changelog and include the Fixes:.
From: Xiu Jianfeng <xiujianfeng@...wei.com>
Subject: mm/hugetlb_cgroup: fix -Wformat-truncation warning
Date: Mon, 22 Dec 2025 07:23:59 +0000
A false-positive compile warnings with -Wformat-trucation was introduced
by commit 47179fe03588 ("mm/hugetlb_cgroup: prepare cftypes based on
template") on arch s390. Suppress it by replacing snprintf() with
scnprintf().
mm/hugetlb_cgroup.c: In function 'hugetlb_cgroup_file_init':
mm/hugetlb_cgroup.c:829:44: warning: '%s' directive output may be truncated writing up to 1623 bytes into a region of size between 32 and 63 [-Wformat-truncation=]
829 | snprintf(cft->name, MAX_CFTYPE_NAME, "%s.%s", buf, tmpl->name);
| ^~
Link: https://lkml.kernel.org/r/20251222072359.3626182-1-xiujianfeng@huaweicloud.com
Fixes: 47179fe03588 ("mm/hugetlb_cgroup: prepare cftypes based on template")
Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.com>
Reported-by: kernel test robot <lkp@...el.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512212332.9lFRbgdS-lkp@intel.com/
Cc: "David Hildenbrand (Red Hat)" <david@...nel.org>
Cc: Muchun Song <muchun.song@...ux.dev>
Cc: Oscar Salvador <osalvador@...e.de>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---
mm/hugetlb_cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/mm/hugetlb_cgroup.c~mm-hugetlb_cgroup-fix-wformat-truncation-warning
+++ a/mm/hugetlb_cgroup.c
@@ -822,7 +822,7 @@ hugetlb_cgroup_cfttypes_init(struct hsta
for (i = 0; i < tmpl_size; cft++, tmpl++, i++) {
*cft = *tmpl;
/* rebuild the name */
- snprintf(cft->name, MAX_CFTYPE_NAME, "%s.%s", buf, tmpl->name);
+ scnprintf(cft->name, MAX_CFTYPE_NAME, "%s.%s", buf, tmpl->name);
/* rebuild the private */
cft->private = MEMFILE_PRIVATE(idx, tmpl->private);
/* rebuild the file_offset */
_
Powered by blists - more mailing lists