From: kernel test robot <lkp@intel.com>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [linyunsheng:page_frag_cache_v5 14/14] mm/page_frag_cache.c:291:24: warning: variable 'remaining' is uninitialized when used here
Date: Sat, 18 May 2024 23:45:08 +0800 [thread overview]
Message-ID: <202405182348.NZ2WqUhQ-lkp@intel.com> (raw)
tree: https://github.com/gestionlin/linux.git page_frag_cache_v5
head: e6543161a8d13e28e244803a755a007021b9dea7
commit: e6543161a8d13e28e244803a755a007021b9dea7 [14/14] add alloc_pg api and refactor alloc_va api
config: arm-clps711x_defconfig (https://download.01.org/0day-ci/archive/20240518/202405182348.NZ2WqUhQ-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project fa9b1be45088dce1e4b602d451f118128b94237b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240518/202405182348.NZ2WqUhQ-lkp@intel.com/reproduce)
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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405182348.NZ2WqUhQ-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from mm/page_frag_cache.c:17:
In file included from include/linux/mm.h:2210:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
mm/page_frag_cache.c:289:15: warning: unused variable 'page' [-Wunused-variable]
289 | struct page *page;
| ^~~~
>> mm/page_frag_cache.c:291:24: warning: variable 'remaining' is uninitialized when used here [-Wuninitialized]
291 | if (unlikely(fragsz > remaining)) {
| ^~~~~~~~~
include/linux/compiler.h:77:42: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^
mm/page_frag_cache.c:288:24: note: initialize the variable 'remaining' to silence this warning
288 | unsigned int remaining;
| ^
| = 0
3 warnings generated.
vim +/remaining +291 mm/page_frag_cache.c
269
270 /**
271 * __page_frag_alloc_va_align() - Alloc a page fragment with aligning
272 * requirement.
273 * @nc: page_frag cache from which to allocate
274 * @fragsz: the requested fragment size
275 * @gfp_mask: the allocation gfp to use when cache need to be refilled
276 * @align_mask: the requested aligning requirement for the 'va'
277 *
278 * Get a page fragment from page_frag cache with aligning requirement.
279 *
280 * Return:
281 * Return va of the page fragment, otherwise return NULL.
282 */
283 void *__page_frag_alloc_va_align(struct page_frag_cache *nc,
284 unsigned int fragsz, gfp_t gfp_mask,
285 unsigned int align_mask)
286 {
287 struct encoded_va *encoded_va;
288 unsigned int remaining;
289 struct page *page;
290
> 291 if (unlikely(fragsz > remaining)) {
292 /* fragsz is not supposed to be bigger than PAGE_SIZE as we are
293 * allowing order 3 page allocation to fail easily under low
294 * memory condition.
295 */
296 if (WARN_ON_ONCE(fragsz > PAGE_SIZE) ||
297 unlikely(!page_frag_cache_refill(nc, gfp_mask)))
298 return NULL;
299 }
300
301 encoded_va = nc->encoded_va;
302 remaining = nc->remaining & align_mask;
303 nc->remaining = remaining - fragsz;
304 nc->pagecnt_bias--;
305
306 return encoded_page_address(encoded_va) +
307 __page_frag_cache_page_offset(encoded_va, remaining);
308 }
309 EXPORT_SYMBOL(__page_frag_alloc_va_align);
310
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-05-18 15:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=202405182348.NZ2WqUhQ-lkp@intel.com \
--to=lkp@intel.com \
--cc=linyunsheng@huawei.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).