lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202208071225.24zEKaj6-lkp@intel.com>
Date:   Sun, 7 Aug 2022 12:41:07 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jiri Olsa <jolsa@...nel.org>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [jolsa-perf:bpf/tracing_multi_new_2 14/21]
 kernel/bpf/trampoline.c:1075:16: warning: variable 'ip' set but not used

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/tracing_multi_new_2
head:   c0620f064b5146578de80c7bb00febc697cc4890
commit: 4d3060dcb11c6c79779105d68c1fd8e0efdbef5a [14/21] bpf: Add support to attach multi trampolines
config: riscv-randconfig-r042-20220804 (https://download.01.org/0day-ci/archive/20220807/202208071225.24zEKaj6-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 26dd42705c2af0b8f6e5d6cdb32c9bd5ed9524eb)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?id=4d3060dcb11c6c79779105d68c1fd8e0efdbef5a
        git remote add jolsa-perf https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
        git fetch --no-tags jolsa-perf bpf/tracing_multi_new_2
        git checkout 4d3060dcb11c6c79779105d68c1fd8e0efdbef5a
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash kernel/bpf/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> kernel/bpf/trampoline.c:1075:16: warning: variable 'ip' set but not used [-Wunused-but-set-variable]
           unsigned long ip, image_new, image_old;
                         ^
>> kernel/bpf/trampoline.c:1074:9: warning: variable 'rollback_cnt' set but not used [-Wunused-but-set-variable]
           int i, rollback_cnt = 0, err = -EINVAL;
                  ^
   2 warnings generated.


vim +/ip +1075 kernel/bpf/trampoline.c

  1070	
  1071	static int bpf_tramp_update_set(struct list_head *upd)
  1072	{
  1073		struct bpf_trampoline *tr, *trm = NULL;
> 1074		int i, rollback_cnt = 0, err = -EINVAL;
> 1075		unsigned long ip, image_new, image_old;
  1076	
  1077		list_for_each_entry(tr, upd, update.list) {
  1078			if (tr->multi.id_multi) {
  1079				trm = tr;
  1080				continue;
  1081			}
  1082	
  1083			ip = (unsigned long) tr->func.addr;
  1084			image_new = tr->update.im ? (unsigned long) tr->update.im->image : 0;
  1085			image_old = tr->cur_image ? (unsigned long) tr->cur_image->image : 0;
  1086	
  1087			switch (tr->update.action) {
  1088			case BPF_TRAMP_UPDATE_REG:
  1089				err = register_ftrace_direct_multi(tr->fops, image_new);
  1090				break;
  1091			case BPF_TRAMP_UPDATE_MODIFY:
  1092				err = modify_ftrace_direct_multi(tr->fops, image_new);
  1093				break;
  1094			case BPF_TRAMP_UPDATE_UNREG:
  1095				err = unregister_ftrace_direct_multi(tr->fops, image_old);
  1096				break;
  1097			}
  1098			if (err)
  1099				goto out_rollback;
  1100			rollback_cnt++;
  1101		}
  1102	
  1103		if (!trm)
  1104			return 0;
  1105	
  1106		if (trm->update.action == BPF_TRAMP_UPDATE_REG) {
  1107			for (i = 0; i < trm->multi.id_multi->cnt; i++) {
  1108				ip = (unsigned long) trm->multi.id_multi->addr[i];
  1109				err = ftrace_set_filter_ip(trm->fops, ip, 0, 0);
  1110				if (err)
  1111					goto out_rollback;
  1112			}
  1113		}
  1114	
  1115		image_new = trm->update.im ? (unsigned long) trm->update.im->image : 0;
  1116		image_old = trm->cur_image ? (unsigned long) trm->cur_image->image : 0;
  1117	
  1118		switch (trm->update.action) {
  1119		case BPF_TRAMP_UPDATE_REG:
  1120			err = register_ftrace_direct_multi(trm->fops, image_new);
  1121			break;
  1122		case BPF_TRAMP_UPDATE_MODIFY:
  1123			err = modify_ftrace_direct_multi(trm->fops, image_new);
  1124			break;
  1125		case BPF_TRAMP_UPDATE_UNREG:
  1126			err = unregister_ftrace_direct_multi(trm->fops, image_old);
  1127			break;
  1128		default:
  1129			break;
  1130		}
  1131	
  1132		if (!err)
  1133			return 0;
  1134	
  1135	out_rollback:
  1136		list_for_each_entry(tr, upd, update.list) {
  1137			if (tr->multi.id_multi)
  1138				continue;
  1139	
  1140			ip = (unsigned long) tr->func.addr;
  1141			image_new = tr->update.im ? (unsigned long) tr->update.im->image : 0;
  1142			image_old = tr->cur_image ? (unsigned long) tr->cur_image->image : 0;
  1143	
  1144			switch (tr->update.action) {
  1145			case BPF_TRAMP_UPDATE_REG:
  1146				err = unregister_ftrace_direct_multi(tr->fops, image_new);
  1147				break;
  1148			case BPF_TRAMP_UPDATE_MODIFY:
  1149				err = modify_ftrace_direct_multi(tr->fops, image_old);
  1150				break;
  1151			case BPF_TRAMP_UPDATE_UNREG:
  1152				err = register_ftrace_direct_multi(tr->fops, image_old);
  1153				break;
  1154			}
  1155			i++;
  1156		}
  1157	
  1158		return err;
  1159	}
  1160	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ