All of lore.kernel.org
 help / color / mirror / Atom feed
* [rgushchin:bpfoom.3.6 5/16] kernel/bpf/bpf_struct_ops.c:1390:8: error: incompatible integer to pointer conversion assigning to 'struct cgroup *' from 'int'
@ 2025-12-31  2:59 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-12-31  2:59 UTC (permalink / raw)
  To: Roman Gushchin; +Cc: oe-kbuild-all

tree:   https://github.com/rgushchin/linux.git bpfoom.3.6
head:   d16fa0113ece3fae58e5105dbed6b0dbe1c28c21
commit: 139148647969dcf54237b1ceb50a89e39b0b5186 [5/16] bpf: Allow attaching struct_ops to cgroups
config: s390-randconfig-r113-20251231 (https://download.01.org/0day-ci/archive/20251231/202512311046.WsU9VT6g-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 86b9f90b9574b3a7d15d28a91f6316459dcfa046)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251231/202512311046.WsU9VT6g-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202512311046.WsU9VT6g-lkp@intel.com/

All errors (new ones prefixed by >>):

   kernel/bpf/bpf_struct_ops.c:1390:10: error: call to undeclared function 'cgroup_get_from_fd'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1390 |                 cgrp = cgroup_get_from_fd(attr->link_create.target_fd);
         |                        ^
   kernel/bpf/bpf_struct_ops.c:1390:10: note: did you mean 'cgroup_id_from_mm'?
   include/linux/memcontrol.h:1454:19: note: 'cgroup_id_from_mm' declared here
    1454 | static inline u64 cgroup_id_from_mm(struct mm_struct *mm)
         |                   ^
>> kernel/bpf/bpf_struct_ops.c:1390:8: error: incompatible integer to pointer conversion assigning to 'struct cgroup *' from 'int' [-Wint-conversion]
    1390 |                 cgrp = cgroup_get_from_fd(attr->link_create.target_fd);
         |                      ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> kernel/bpf/bpf_struct_ops.c:1398:4: error: call to undeclared function 'cgroup_put'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1398 |                         cgroup_put(cgrp);
         |                         ^
   3 errors generated.


vim +1390 kernel/bpf/bpf_struct_ops.c

  1357	
  1358	int bpf_struct_ops_link_create(union bpf_attr *attr)
  1359	{
  1360		struct bpf_struct_ops_link *link = NULL;
  1361		struct bpf_link_primer link_primer;
  1362		struct bpf_struct_ops_map *st_map;
  1363		struct bpf_map *map;
  1364		struct cgroup *cgrp;
  1365		int err;
  1366	
  1367		if (attr->link_create.flags & ~BPF_F_CGROUP_FD)
  1368			return -EINVAL;
  1369	
  1370		map = bpf_map_get(attr->link_create.map_fd);
  1371		if (IS_ERR(map))
  1372			return PTR_ERR(map);
  1373	
  1374		st_map = (struct bpf_struct_ops_map *)map;
  1375	
  1376		if (!bpf_struct_ops_valid_to_reg(map)) {
  1377			err = -EINVAL;
  1378			goto err_out;
  1379		}
  1380	
  1381		link = kzalloc(sizeof(*link), GFP_USER);
  1382		if (!link) {
  1383			err = -ENOMEM;
  1384			goto err_out;
  1385		}
  1386		bpf_link_init(&link->link, BPF_LINK_TYPE_STRUCT_OPS, &bpf_struct_ops_map_lops, NULL,
  1387			      attr->link_create.attach_type);
  1388	
  1389		if (attr->link_create.flags & BPF_F_CGROUP_FD) {
> 1390			cgrp = cgroup_get_from_fd(attr->link_create.target_fd);
  1391			if (IS_ERR(cgrp)) {
  1392				err = PTR_ERR(cgrp);
  1393				goto err_out;
  1394			}
  1395			link->cgroup = cgrp;
  1396			err = cgroup_bpf_attach_struct_ops(cgrp, link);
  1397			if (err) {
> 1398				cgroup_put(cgrp);
  1399				link->cgroup = NULL;
  1400				goto err_out;
  1401			}
  1402		}
  1403	
  1404		err = bpf_link_prime(&link->link, &link_primer);
  1405		if (err)
  1406			goto err_put_cgroup;
  1407	
  1408		init_waitqueue_head(&link->wait_hup);
  1409	
  1410		/* Hold the update_mutex such that the subsystem cannot
  1411		 * do link->ops->detach() before the link is fully initialized.
  1412		 */
  1413		mutex_lock(&update_mutex);
  1414		err = st_map->st_ops_desc->st_ops->reg(st_map->kvalue.data, &link->link);
  1415		if (err) {
  1416			mutex_unlock(&update_mutex);
  1417			bpf_link_cleanup(&link_primer);
  1418			link = NULL;
  1419			goto err_out;
  1420		}
  1421		RCU_INIT_POINTER(link->map, map);
  1422		mutex_unlock(&update_mutex);
  1423	
  1424		return bpf_link_settle(&link_primer);
  1425	
  1426	err_put_cgroup:
  1427		if (link->cgroup)
  1428			cgroup_bpf_detach_struct_ops(link->cgroup, link);
  1429	err_out:
  1430		bpf_map_put(map);
  1431		kfree(link);
  1432		return err;
  1433	}
  1434	

-- 
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:[~2025-12-31  3:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-31  2:59 [rgushchin:bpfoom.3.6 5/16] kernel/bpf/bpf_struct_ops.c:1390:8: error: incompatible integer to pointer conversion assigning to 'struct cgroup *' from 'int' kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.