From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5919449541180857705==" MIME-Version: 1.0 From: kernel test robot To: kbuild-all@lists.01.org Subject: [android-common:android-4.9-q 17834/23976] kernel/bpf/cgroup.c:195:6: warning: variable 'old_flags' set but not used Date: Thu, 25 Nov 2021 00:54:01 +0800 Message-ID: <202111250056.v06XiDcb-lkp@intel.com> List-Id: --===============5919449541180857705== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Alexei, FYI, the error/warning still remains. tree: https://android.googlesource.com/kernel/common android-4.9-q head: 2cf6889f68d95315b5b012d2e920596683a227cb commit: 148f111e986ba49e7e264fd798329aaa636300f3 [17834/23976] BACKPORT: bp= f: multi program support for cgroup+bpf config: i386-randconfig-r034-20211122 (https://download.01.org/0day-ci/arch= ive/20211125/202111250056.v06XiDcb-lkp(a)intel.com/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=3D1 build): git remote add android-common https://android.googlesource.com/kern= el/common git fetch --no-tags android-common android-4.9-q git checkout 148f111e986ba49e7e264fd798329aaa636300f3 # save the config file to linux build tree make W=3D1 ARCH=3Di386 = If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): In file included from include/linux/cgroup.h:11:0, from kernel/bpf/cgroup.c:13: include/linux/sched.h:1201:1: warning: type qualifiers ignored on functi= on return type [-Wignored-qualifiers] const struct sched_group_energy * const(*sched_domain_energy_f)(int cpu= ); ^~~~~ kernel/bpf/cgroup.c: In function '__cgroup_bpf_attach': >> kernel/bpf/cgroup.c:195:6: warning: variable 'old_flags' set but not use= d [-Wunused-but-set-variable] u32 old_flags; ^~~~~~~~~ vim +/old_flags +195 kernel/bpf/cgroup.c 177 = 178 /** 179 * __cgroup_bpf_attach() - Attach the program to a cgroup, and 180 * propagate the change to descendants 181 * @cgrp: The cgroup which descendants to traverse 182 * @prog: A program to attach 183 * @type: Type of attach operation 184 * 185 * Must be called with cgroup_mutex held. 186 */ 187 int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, 188 enum bpf_attach_type type, u32 flags) 189 { 190 struct list_head *progs =3D &cgrp->bpf.progs[type]; 191 struct bpf_prog *old_prog =3D NULL; 192 struct cgroup_subsys_state *css; 193 struct bpf_prog_list *pl; 194 bool pl_was_allocated; > 195 u32 old_flags; 196 int err; 197 = 198 if ((flags & BPF_F_ALLOW_OVERRIDE) && (flags & BPF_F_ALLOW_MULTI)) 199 /* invalid combination */ 200 return -EINVAL; 201 = 202 if (!hierarchy_allows_attach(cgrp, type, flags)) 203 return -EPERM; 204 = 205 if (!list_empty(progs) && cgrp->bpf.flags[type] !=3D flags) 206 /* Disallow attaching non-overridable on top 207 * of existing overridable in this cgroup. 208 * Disallow attaching multi-prog if overridable or none 209 */ 210 return -EPERM; 211 = 212 if (prog_list_length(progs) >=3D BPF_CGROUP_MAX_PROGS) 213 return -E2BIG; 214 = 215 if (flags & BPF_F_ALLOW_MULTI) { 216 list_for_each_entry(pl, progs, node) 217 if (pl->prog =3D=3D prog) 218 /* disallow attaching the same prog twice */ 219 return -EINVAL; 220 = 221 pl =3D kmalloc(sizeof(*pl), GFP_KERNEL); 222 if (!pl) 223 return -ENOMEM; 224 pl_was_allocated =3D true; 225 pl->prog =3D prog; 226 list_add_tail(&pl->node, progs); 227 } else { 228 if (list_empty(progs)) { 229 pl =3D kmalloc(sizeof(*pl), GFP_KERNEL); 230 if (!pl) 231 return -ENOMEM; 232 pl_was_allocated =3D true; 233 list_add_tail(&pl->node, progs); 234 } else { 235 pl =3D list_first_entry(progs, typeof(*pl), node); 236 old_prog =3D pl->prog; 237 pl_was_allocated =3D false; 238 } 239 pl->prog =3D prog; 240 } 241 = 242 old_flags =3D cgrp->bpf.flags[type]; 243 cgrp->bpf.flags[type] =3D flags; 244 = 245 /* allocate and recompute effective prog arrays */ 246 css_for_each_descendant_pre(css, &cgrp->self) { 247 struct cgroup *desc =3D container_of(css, struct cgroup, self); 248 = 249 err =3D compute_effective_progs(desc, type, &desc->bpf.inactive); 250 if (err) 251 goto cleanup; 252 } 253 = 254 /* all allocations were successful. Activate all prog arrays */ 255 css_for_each_descendant_pre(css, &cgrp->self) { 256 struct cgroup *desc =3D container_of(css, struct cgroup, self); 257 = 258 activate_effective_progs(desc, type, desc->bpf.inactive); 259 desc->bpf.inactive =3D NULL; 260 } 261 = 262 static_branch_inc(&cgroup_bpf_enabled_key); 263 if (old_prog) { 264 bpf_prog_put(old_prog); 265 static_branch_dec(&cgroup_bpf_enabled_key); 266 } 267 return 0; 268 = 269 cleanup: 270 /* oom while computing effective. Free all computed effective arrays 271 * since they were not activated 272 */ 273 css_for_each_descendant_pre(css, &cgrp->self) { 274 struct cgroup *desc =3D container_of(css, struct cgroup, self); 275 = 276 bpf_prog_array_free(desc->bpf.inactive); 277 desc->bpf.inactive =3D NULL; 278 } 279 = 280 /* and cleanup the prog list */ 281 pl->prog =3D old_prog; 282 if (pl_was_allocated) { 283 list_del(&pl->node); 284 kfree(pl); 285 } 286 return err; 287 } 288 = --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org --===============5919449541180857705==--