* [axboe-block:rw_iter 97/438] mm/vmscan.c:5471 lru_gen_seq_write() warn: potential spectre issue 'next' [w]
@ 2024-04-16 7:51 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-04-16 7:51 UTC (permalink / raw
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jens Axboe <axboe@kernel.dk>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git rw_iter
head: fe753ea36f846c5a5638f1db502ba023e76132ae
commit: c978484d1a48a8af3b7f68d2a9577ce99dc2ed7b [97/438] mm: convert to read/write iterators
:::::: branch date: 14 hours ago
:::::: commit date: 14 hours ago
config: x86_64-randconfig-161-20240416 (https://download.01.org/0day-ci/archive/20240416/202404161528.rTGrLAJh-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 <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202404161528.rTGrLAJh-lkp@intel.com/
smatch warnings:
mm/vmscan.c:5471 lru_gen_seq_write() warn: potential spectre issue 'next' [w]
vim +/next +5471 mm/vmscan.c
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5435
07017acb06012d Yu Zhao 2022-09-18 5436 /* see Documentation/admin-guide/mm/multigen_lru.rst for details */
c978484d1a48a8 Jens Axboe 2024-04-03 5437 static ssize_t lru_gen_seq_write(struct kiocb *iocb, struct iov_iter *from)
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5438 {
c978484d1a48a8 Jens Axboe 2024-04-03 5439 size_t len = iov_iter_count(from);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5440 void *buf;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5441 char *cur, *next;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5442 unsigned int flags;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5443 struct blk_plug plug;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5444 int err = -EINVAL;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5445 struct scan_control sc = {
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5446 .may_writepage = true,
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5447 .may_unmap = true,
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5448 .may_swap = true,
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5449 .reclaim_idx = MAX_NR_ZONES - 1,
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5450 .gfp_mask = GFP_KERNEL,
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5451 };
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5452
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5453 buf = kvmalloc(len + 1, GFP_KERNEL);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5454 if (!buf)
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5455 return -ENOMEM;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5456
c978484d1a48a8 Jens Axboe 2024-04-03 5457 if (!copy_from_iter_full(buf, len, from)) {
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5458 kvfree(buf);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5459 return -EFAULT;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5460 }
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5461
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5462 set_task_reclaim_state(current, &sc.reclaim_state);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5463 flags = memalloc_noreclaim_save();
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5464 blk_start_plug(&plug);
e9d4e1ee788097 Yu Zhao 2022-12-21 5465 if (!set_mm_walk(NULL, true)) {
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5466 err = -ENOMEM;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5467 goto done;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5468 }
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5469
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5470 next = buf;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 @5471 next[len] = '\0';
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5472
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5473 while ((cur = strsep(&next, ",;\n"))) {
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5474 int n;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5475 int end;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5476 char cmd;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5477 unsigned int memcg_id;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5478 unsigned int nid;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5479 unsigned long seq;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5480 unsigned int swappiness = -1;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5481 unsigned long opt = -1;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5482
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5483 cur = skip_spaces(cur);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5484 if (!*cur)
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5485 continue;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5486
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5487 n = sscanf(cur, "%c %u %u %lu %n %u %n %lu %n", &cmd, &memcg_id, &nid,
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5488 &seq, &end, &swappiness, &end, &opt, &end);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5489 if (n < 4 || cur[end]) {
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5490 err = -EINVAL;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5491 break;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5492 }
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5493
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5494 err = run_cmd(cmd, memcg_id, nid, seq, &sc, swappiness, opt);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5495 if (err)
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5496 break;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5497 }
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5498 done:
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5499 clear_mm_walk();
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5500 blk_finish_plug(&plug);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5501 memalloc_noreclaim_restore(flags);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5502 set_task_reclaim_state(current, NULL);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5503
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5504 kvfree(buf);
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5505
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5506 return err ? : len;
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5507 }
d6c3af7d8a2ba5 Yu Zhao 2022-09-18 5508
:::::: The code at line 5471 was first introduced by commit
:::::: d6c3af7d8a2ba5602c28841248c551a712ac50f5 mm: multi-gen LRU: debugfs interface
:::::: TO: Yu Zhao <yuzhao@google.com>
:::::: CC: Andrew Morton <akpm@linux-foundation.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-16 7:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-16 7:51 [axboe-block:rw_iter 97/438] mm/vmscan.c:5471 lru_gen_seq_write() warn: potential spectre issue 'next' [w] kernel test robot
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).