From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7F9B12110E for ; Mon, 22 Dec 2025 19:15:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766430932; cv=none; b=uNA6KEhObxqh1I9KqrytfqdjKrkjUFmRklUqQBnh3bkq+G4mq5qQGemiGW46Qtm6gJp9TSj/pJItAkxKaL099K0hhEbuTAkc+6g8ukwDOL8wxwo4CW9l7AWeYWNn2yWaQ+NAZu/9X9YO6NOjeYepzarZaUFazlEx8GZQtUizlMo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766430932; c=relaxed/simple; bh=ZRlCmMLr4Nbla5Ea1HsL7EGP9Zb5RozaswG2lrCEFmQ=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=bWhJsB6KQumL98u/nvEs/08XeSD+vTcrjfy0KF37Y6+kiK9m87DzBy3D7Hkxgru/AKw4JCNKjlrRInCpKOx+rsXYpeODU14IVj414EW2R/B4qgS28KfHik5O8indCKgZXOosI1O1Yps5KyuKz+/xAEQXz9yuNFg442yZCphJNJU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=CaW6hLls; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="CaW6hLls" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5966CC4CEF1; Mon, 22 Dec 2025 19:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1766430931; bh=ZRlCmMLr4Nbla5Ea1HsL7EGP9Zb5RozaswG2lrCEFmQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CaW6hLlsgJSiN6lRCXIeAo3h2E/EWeCOVZqZER8LumIarNglhFPCl8ezChq+pHfJ3 F5T401ixji8FJV3WCU9lhy0dqpkBxPUU6PD6YojWnjVxqxzKD8tGlukAqQho/cjU8N 4yJigNRMkRlzEimnWG8J+nRFQVtbeSHgTWcorERg= Date: Mon, 22 Dec 2025 11:15:30 -0800 From: Andrew Morton To: Xiu Jianfeng Cc: muchun.song@linux.dev, osalvador@suse.de, david@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] mm/hugetlb_cgroup: fix -Wformat-truncation warning Message-Id: <20251222111530.c285692e5872035d6ee68264@linux-foundation.org> In-Reply-To: <20251222072359.3626182-1-xiujianfeng@huaweicloud.com> References: <20251222072359.3626182-1-xiujianfeng@huaweicloud.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 22 Dec 2025 07:23:59 +0000 Xiu Jianfeng 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 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 Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202512212332.9lFRbgdS-lkp@intel.com/ Cc: "David Hildenbrand (Red Hat)" Cc: Muchun Song Cc: Oscar Salvador Signed-off-by: Andrew Morton --- 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 */ _