oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [jolsa-perf:uprobe_multi_3 5/11] kernel/trace/bpf_trace.c:2913:25: warning: variable 'size' set but not used
@ 2023-03-10 20:39 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-03-10 20:39 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git uprobe_multi_3
head:   e4e32b8d0e93fb058e99e0bb197f155b3b71cf26
commit: d7c8fc41fafecf762d8e6fd76a8363d24051f8af [5/11] bpf: Add multi uprobe link
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20230311/202303110431.Cdr8Bsa7-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?id=d7c8fc41fafecf762d8e6fd76a8363d24051f8af
        git remote add jolsa-perf https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
        git fetch --no-tags jolsa-perf uprobe_multi_3
        git checkout d7c8fc41fafecf762d8e6fd76a8363d24051f8af
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash kernel/trace/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303110431.Cdr8Bsa7-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/trace/bpf_trace.c: In function 'bpf_uprobe_multi_link_attach':
>> kernel/trace/bpf_trace.c:2913:25: warning: variable 'size' set but not used [-Wunused-but-set-variable]
    2913 |         u32 flags, cnt, size, i;
         |                         ^~~~


vim +/size +2913 kernel/trace/bpf_trace.c

  2909	
  2910	int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
  2911	{
  2912		void __user **upaths, __user *uoffsets, __user *upath, __user *old_upath = NULL;
> 2913		u32 flags, cnt, size, i;
  2914		char **paths, *path;
  2915		int err;
  2916	
  2917		/* no support for 32bit archs yet */
  2918		if (sizeof(u64) != sizeof(void *))
  2919			return -EOPNOTSUPP;
  2920	
  2921		if (prog->expected_attach_type != BPF_TRACE_UPROBE_MULTI)
  2922			return -EINVAL;
  2923	
  2924		flags = attr->link_create.uprobe_multi.flags;
  2925		if (flags & ~BPF_F_UPROBE_MULTI_RETURN)
  2926			return -EINVAL;
  2927	
  2928		upaths = u64_to_user_ptr(attr->link_create.uprobe_multi.paths);
  2929		uoffsets = u64_to_user_ptr(attr->link_create.uprobe_multi.offsets);
  2930		if (!!upaths != !!uoffsets)
  2931			return -EINVAL;
  2932	
  2933		cnt = attr->link_create.uprobe_multi.cnt;
  2934		if (!cnt)
  2935			return -EINVAL;
  2936	
  2937		size = cnt * sizeof(*paths);
  2938		paths = kvmalloc_array(cnt, sizeof(*paths), GFP_KERNEL);
  2939		if (!paths)
  2940			return -ENOMEM;
  2941	
  2942		for (i = 0; i < cnt; i++) {
  2943			if (__get_user(upath, upaths + i)) {
  2944				err = -EFAULT;
  2945				goto error;
  2946			}
  2947			if (i && old_upath == upath) {
  2948				paths[i] = paths[i - 1];
  2949				continue;
  2950			}
  2951			path = strndup_user(upath, PATH_MAX);
  2952			if (IS_ERR(path)) {
  2953				err = PTR_ERR(path);
  2954				goto error;
  2955			}
  2956			paths[i] = path;
  2957		}
  2958	
  2959		for (i = 0; i < cnt; i++) {
  2960			trace_printk("path %s\n", paths[i]);
  2961		}
  2962	
  2963	error:
  2964		kfree(paths);
  2965		return err;
  2966	}
  2967	#else /* !CONFIG_UPROBES */
  2968	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-10 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 20:39 [jolsa-perf:uprobe_multi_3 5/11] kernel/trace/bpf_trace.c:2913:25: warning: variable 'size' set but not used 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 NNTP newsgroup(s).