linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: xiujianfeng <xiujianfeng@huawei.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	<oe-kbuild@lists.linux.dev>, <akpm@linux-foundation.org>,
	<muchun.song@linux.dev>
Cc: <lkp@intel.com>, <oe-kbuild-all@lists.linux.dev>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next 2/3] mm/hugetlb_cgroup: prepare cftypes based on template
Date: Wed, 5 Jun 2024 14:15:14 +0800	[thread overview]
Message-ID: <84a65024-d96c-3fa5-c015-98130ee82ccb@huawei.com> (raw)
In-Reply-To: <87bca9ca-0c3e-449a-b121-eee7b84dc2ed@moroto.mountain>



On 2024/6/5 13:24, Dan Carpenter wrote:
> Hi Xiu,
> 
> kernel test robot noticed the following build warnings:
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Xiu-Jianfeng/mm-hugetlb_cgroup-identify-the-legacy-using-cgroup_subsys_on_dfl/20240603-201513
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link:    https://lore.kernel.org/r/20240603120506.1837322-3-xiujianfeng%40huawei.com
> patch subject: [PATCH -next 2/3] mm/hugetlb_cgroup: prepare cftypes based on template
> config: i386-randconfig-r071-20240604 (https://download.01.org/0day-ci/archive/20240605/202406050210.OWthxCFt-lkp@intel.com/config)
> compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202406050210.OWthxCFt-lkp@intel.com/
> 
> smatch warnings:
> mm/hugetlb_cgroup.c:828 hugetlb_cgroup_cfttypes_init() warn: this array is probably non-NULL. 'tmpl->name'
> 
> vim +828 mm/hugetlb_cgroup.c
> 
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  815  static void __init
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  816  hugetlb_cgroup_cfttypes_init(struct hstate *h, struct cftype *cft,
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  817  			     struct cftype *tmpl, int tmpl_size)
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  818  {
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  819  	char buf[32];
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  820  	int i, idx = hstate_index(h);
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  821  
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  822  	/* format the size */
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  823  	mem_fmt(buf, sizeof(buf), huge_page_size(h));
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  824  
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  825  	for (i = 0; i < tmpl_size; cft++, tmpl++, i++) {
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  826  		*cft = *tmpl;
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  827  		/* rebuild the name */
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03 @828  		if (tmpl->name)
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  829  			snprintf(cft->name, MAX_CFTYPE_NAME, "%s.%s", buf, tmpl->name);
> 
> tmpl->name is an array so it's non-NULL.  Just do the snprintf().  No
> need for the if statement.

Hi Dan,

Thanks for you review, will fix in the next version.

> 
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  830  		/* rebuild the private */
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  831  		if (tmpl->private)
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  832  			cft->private = MEMFILE_PRIVATE(idx, tmpl->private);
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  833  		/* rebuild the file_offset */
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  834  		if (tmpl->file_offset) {
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  835  			unsigned int offset = tmpl->file_offset;
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  836  
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  837  			cft->file_offset = MEMFILE_OFFSET0(offset) +
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  838  					   MEMFILE_FIELD_SIZE(offset) * idx;
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  839  		}
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  840  	}
> 66bcc9ace99241 Xiu Jianfeng 2024-06-03  841  }
> 


  reply	other threads:[~2024-06-05  6:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-03 12:05 [PATCH -next 0/3] mm/hugetlb_cgroup: rework on cftypes Xiu Jianfeng
2024-06-03 12:05 ` [PATCH -next 1/3] mm/hugetlb_cgroup: identify the legacy using cgroup_subsys_on_dfl() Xiu Jianfeng
2024-06-03 12:05 ` [PATCH -next 2/3] mm/hugetlb_cgroup: prepare cftypes based on template Xiu Jianfeng
2024-06-03 15:36   ` kernel test robot
2024-06-03 21:25   ` kernel test robot
2024-06-04  1:16     ` xiujianfeng
2024-06-05  5:24   ` Dan Carpenter
2024-06-05  6:15     ` xiujianfeng [this message]
2024-06-03 12:05 ` [PATCH -next 3/3] mm/hugetlb_cgroup: switch to the new cftypes Xiu Jianfeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84a65024-d96c-3fa5-c015-98130ee82ccb@huawei.com \
    --to=xiujianfeng@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=muchun.song@linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox