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]
Message-ID: <20161220142127.GZ1074@mtr-leonro.local>
Date:   Tue, 20 Dec 2016 16:21:27 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Geliang Tang <geliangtang@...il.com>
Cc:     Mike Marciniszyn <infinipath@...el.com>,
        Doug Ledford <dledford@...hat.com>,
        Sean Hefty <sean.hefty@...el.com>,
        Hal Rosenstock <hal.rosenstock@...il.com>,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] IB/qib: use rb_entry()

On Tue, Dec 20, 2016 at 10:02:12PM +0800, Geliang Tang wrote:
> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
>
> Signed-off-by: Geliang Tang <geliangtang@...il.com>
> ---
>  drivers/infiniband/hw/qib/qib_user_sdma.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks,
Reviewed-by: Leon Romanovsky <leonro@...lanox.com>

> diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c b/drivers/infiniband/hw/qib/qib_user_sdma.c
> index 3e0677c..926f3c8 100644
> --- a/drivers/infiniband/hw/qib/qib_user_sdma.c
> +++ b/drivers/infiniband/hw/qib/qib_user_sdma.c
> @@ -144,8 +144,8 @@ qib_user_sdma_rb_search(struct rb_root *root, pid_t pid)
>  	struct rb_node *node = root->rb_node;
>
>  	while (node) {
> -		sdma_rb_node = container_of(node,
> -			struct qib_user_sdma_rb_node, node);
> +		sdma_rb_node = rb_entry(node, struct qib_user_sdma_rb_node,
> +					node);
>  		if (pid < sdma_rb_node->pid)
>  			node = node->rb_left;
>  		else if (pid > sdma_rb_node->pid)
> @@ -164,7 +164,7 @@ qib_user_sdma_rb_insert(struct rb_root *root, struct qib_user_sdma_rb_node *new)
>  	struct qib_user_sdma_rb_node *got;
>
>  	while (*node) {
> -		got = container_of(*node, struct qib_user_sdma_rb_node, node);
> +		got = rb_entry(*node, struct qib_user_sdma_rb_node, node);
>  		parent = *node;
>  		if (new->pid < got->pid)
>  			node = &((*node)->rb_left);
> --
> 2.9.3
>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ