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: <f5c3fb4b-ba2a-daab-9654-57ca4c35ca49@gmail.com>
Date:   Thu, 22 Dec 2016 09:22:14 +1000
From:   Ben Skeggs <skeggsb@...il.com>
To:     Geliang Tang <geliangtang@...il.com>,
        Ben Skeggs <bskeggs@...hat.com>,
        David Airlie <airlied@...ux.ie>
Cc:     linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        nouveau@...ts.freedesktop.org
Subject: Re: [Nouveau] [PATCH] drm/nouveau/dma: use rb_entry()

On 12/21/2016 12:02 AM, Geliang Tang wrote:
> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
Thanks, I've grabbed the patch.

Ben.

> 
> Signed-off-by: Geliang Tang <geliangtang@...il.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
> index f11ebdd..4655d17 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c
> @@ -34,7 +34,7 @@ nvkm_dma_search(struct nvkm_dma *dma, struct nvkm_client *client, u64 object)
>  	struct rb_node *node = client->dmaroot.rb_node;
>  	while (node) {
>  		struct nvkm_dmaobj *dmaobj =
> -			container_of(node, typeof(*dmaobj), rb);
> +			rb_entry(node, typeof(*dmaobj), rb);
>  		if (object < dmaobj->handle)
>  			node = node->rb_left;
>  		else
> @@ -67,7 +67,7 @@ nvkm_dma_oclass_new(struct nvkm_device *device,
>  	dmaobj->handle = oclass->object;
>  
>  	while (*ptr) {
> -		struct nvkm_dmaobj *obj = container_of(*ptr, typeof(*obj), rb);
> +		struct nvkm_dmaobj *obj = rb_entry(*ptr, typeof(*obj), rb);
>  		parent = *ptr;
>  		if (dmaobj->handle < obj->handle)
>  			ptr = &parent->rb_left;
> 



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