Re: [PATCH v2 14/16] mm: multigenerational lru: user interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Yu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on cgroup/for-next tip/x86/mm fuse/for-next tip/perf/core tip/sched/core linus/master v5.12-rc7]
[cannot apply to hnaz-linux-mm/master next-20210413]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Yu-Zhao/Multigenerational-LRU-Framework/20210413-145844
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 99cb64de36d5c9397a664808b92943e35bdce25e
compiler: h8300-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

   mm/vmscan.c:4110:22: warning: Local variable kswapd shadows outer function [shadowFunction]
    struct task_struct *kswapd = NODE_DATA(nid)->kswapd;
                        ^
   mm/vmscan.c:3912:12: note: Shadowed declaration
   static int kswapd(void *p)
              ^
   mm/vmscan.c:4110:22: note: Shadow variable
    struct task_struct *kswapd = NODE_DATA(nid)->kswapd;
                        ^
   mm/vmscan.c:5460:7: warning: Identical inner 'if' condition is always true. [identicalInnerCondition]
     if (!args)
         ^
   mm/vmscan.c:5435:15: note: 'alloc' is assigned value '!args' here.
    bool alloc = !args;
                 ^
   mm/vmscan.c:5458:6: note: outer condition: alloc
    if (alloc) {
        ^
   mm/vmscan.c:5460:7: note: identical inner condition: !args
     if (!args)
         ^
>> mm/vmscan.c:6613:7: warning: %u in format string (no. 2) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
     n = sscanf(cur, "%c %u %u %lu %n %u %n %lu %n", &cmd, &memcg_id, &nid,
         ^
   mm/vmscan.c:6613:7: warning: %u in format string (no. 3) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
     n = sscanf(cur, "%c %u %u %lu %n %u %n %lu %n", &cmd, &memcg_id, &nid,
         ^
   mm/vmscan.c:6613:7: warning: %u in format string (no. 6) requires 'unsigned int *' but the argument type is 'signed int *'. [invalidScanfArgType_int]
     n = sscanf(cur, "%c %u %u %lu %n %u %n %lu %n", &cmd, &memcg_id, &nid,
         ^
   mm/vmscan.c:4712:12: warning: Possible null pointer dereference: args [nullPointer]
    int nid = args->node_id;
              ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4803:32: note: Calling function 'reset_mm_stats', 3rd argument 'args' value is 0
    reset_mm_stats(mm_list, last, args);
                                  ^
   mm/vmscan.c:4712:12: note: Null pointer dereference
    int nid = args->node_id;
              ^
   mm/vmscan.c:4713:32: warning: Possible null pointer dereference: args [nullPointer]
    int sid = sid_from_seq_or_gen(args->max_seq);
                                  ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4803:32: note: Calling function 'reset_mm_stats', 3rd argument 'args' value is 0
    reset_mm_stats(mm_list, last, args);
                                  ^
   mm/vmscan.c:4713:32: note: Null pointer dereference
    int sid = sid_from_seq_or_gen(args->max_seq);
                                  ^
   mm/vmscan.c:4726:28: warning: Possible null pointer dereference: args [nullPointer]
    sid = sid_from_seq_or_gen(args->max_seq + 1);
                              ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4803:32: note: Calling function 'reset_mm_stats', 3rd argument 'args' value is 0
    reset_mm_stats(mm_list, last, args);
                                  ^
   mm/vmscan.c:4726:28: note: Null pointer dereference
    sid = sid_from_seq_or_gen(args->max_seq + 1);
                              ^
   mm/vmscan.c:4758:12: warning: Possible null pointer dereference: args [nullPointer]
    int nid = args->node_id;
              ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4758:12: note: Null pointer dereference
    int nid = args->node_id;
              ^
   mm/vmscan.c:4759:48: warning: Possible null pointer dereference: args [nullPointer]
    struct lru_gen_mm_list *mm_list = get_mm_list(args->memcg);
                                                  ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4759:48: note: Null pointer dereference
    struct lru_gen_mm_list *mm_list = get_mm_list(args->memcg);
                                                  ^
   mm/vmscan.c:4768:12: warning: Possible null pointer dereference: args [nullPointer]
    VM_BUG_ON(args->max_seq > mm_list->nodes[nid].cur_seq + 1);
              ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4768:12: note: Null pointer dereference
    VM_BUG_ON(args->max_seq > mm_list->nodes[nid].cur_seq + 1);
              ^
   mm/vmscan.c:4769:21: warning: Possible null pointer dereference: args [nullPointer]
    VM_BUG_ON(*iter && args->max_seq < mm_list->nodes[nid].cur_seq);
                       ^
   mm/vmscan.c:5947:55: note: Calling function 'walk_mm_list', 5th argument 'NULL' value is 0
    return walk_mm_list(lruvec, max_seq, sc, swappiness, NULL) ? nr_to_scan : 0;
                                                         ^
   mm/vmscan.c:5471:22: note: Calling function 'get_next_mm', 1st argument 'args' value is 0
     last = get_next_mm(args, swappiness, &mm);
                        ^
   mm/vmscan.c:4769:21: note: Null pointer dereference
    VM_BUG_ON(*iter && args->max_seq < mm_list->nodes[nid].cur_seq);

vim +6613 mm/vmscan.c

  6579	
  6580	static ssize_t lru_gen_seq_write(struct file *file, const char __user *src,
  6581					 size_t len, loff_t *pos)
  6582	{
  6583		void *buf;
  6584		char *cur, *next;
  6585		int err = 0;
  6586	
  6587		buf = kvmalloc(len + 1, GFP_USER);
  6588		if (!buf)
  6589			return -ENOMEM;
  6590	
  6591		if (copy_from_user(buf, src, len)) {
  6592			kvfree(buf);
  6593			return -EFAULT;
  6594		}
  6595	
  6596		next = buf;
  6597		next[len] = '\0';
  6598	
  6599		while ((cur = strsep(&next, ",;\n"))) {
  6600			int n;
  6601			int end;
  6602			char cmd;
  6603			int memcg_id;
  6604			int nid;
  6605			unsigned long seq;
  6606			int swappiness = -1;
  6607			unsigned long nr_to_reclaim = -1;
  6608	
  6609			cur = skip_spaces(cur);
  6610			if (!*cur)
  6611				continue;
  6612	
> 6613			n = sscanf(cur, "%c %u %u %lu %n %u %n %lu %n", &cmd, &memcg_id, &nid,
  6614				   &seq, &end, &swappiness, &end, &nr_to_reclaim, &end);
  6615			if (n < 4 || cur[end]) {
  6616				err = -EINVAL;
  6617				break;
  6618			}
  6619	
  6620			err = advance_seq(cmd, memcg_id, nid, seq, swappiness, nr_to_reclaim);
  6621			if (err)
  6622				break;
  6623		}
  6624	
  6625		kvfree(buf);
  6626	
  6627		return err ? : len;
  6628	}
  6629	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux