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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 13 Aug 2018 07:46:35 -0700
From:   Tejun Heo <tj@...nel.org>
To:     Andrey Ignatov <rdna@...com>
Cc:     netdev@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
        guro@...com, kernel-team@...com
Subject: Re: [PATCH bpf-next 1/4] bpf: Introduce bpf_skb_ancestor_cgroup_id
 helper

Hello, Andrey.

On Fri, Aug 10, 2018 at 10:35:23PM -0700, Andrey Ignatov wrote:
> +static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
> +					     int ancestor_level)
> +{
> +	struct cgroup *ptr;
> +
> +	if (cgrp->level < ancestor_level)
> +		return NULL;
> +
> +	for (ptr = cgrp;
> +	     ptr && ptr->level > ancestor_level;
> +	     ptr = cgroup_parent(ptr))
> +		;
> +
> +	if (ptr && ptr->level == ancestor_level)
> +		return ptr;
> +
> +	return NULL;
> +}

I don't have any objections functionanlity-wise but can we do sth like
the following instead?

static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
					     int ancestor_level)
{
	if (cgrp->level < ancestor_level)
		return NULL;

	while (cgrp->level > ancestor_level)
		cgrp = cgroup_parent(cgrp);
	return cgrp;
}

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ