mirror of
https://github.com/torvalds/linux.git
synced 2026-05-13 00:28:54 +02:00
mm/hugetlb_cgroup: fix -Wformat-truncation warning
A false-positive compile warnings with -Wformat-trucation was introduced by commit47179fe035("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:47179fe035("mm/hugetlb_cgroup: prepare cftypes based on template") Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202512212332.9lFRbgdS-lkp@intel.com/ Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: "David Hildenbrand (Red Hat)" <david@kernel.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Oscar Salvador <osalvador@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
62451ae347
commit
ed60c8e280
|
|
@ -822,7 +822,7 @@ hugetlb_cgroup_cfttypes_init(struct hstate *h, struct cftype *cft,
|
|||
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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user