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] [day] [month] [year] [list]
Date:	Mon, 29 Jul 2013 10:32:59 -0700
From:	Cody P Schafer <cody@...ux.vnet.ibm.com>
To:	Seth Jennings <sjenning@...ux.vnet.ibm.com>
CC:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Linux MM <linux-mm@...ck.org>,
	David Woodhouse <David.Woodhouse@...el.com>,
	Rik van Riel <riel@...hat.com>,
	Michel Lespinasse <walken@...gle.com>
Subject: Re: [PATCH 1/5] rbtree: add postorder iteration functions

On 07/29/2013 08:01 AM, Seth Jennings wrote:
> On Fri, Jul 26, 2013 at 02:13:39PM -0700, Cody P Schafer wrote:
>> diff --git a/lib/rbtree.c b/lib/rbtree.c
>> index c0e31fe..65f4eff 100644
>> --- a/lib/rbtree.c
>> +++ b/lib/rbtree.c
>> @@ -518,3 +518,43 @@ void rb_replace_node(struct rb_node *victim, struct rb_node *new,
>>   	*new = *victim;
>>   }
>>   EXPORT_SYMBOL(rb_replace_node);
>> +
>> +static struct rb_node *rb_left_deepest_node(const struct rb_node *node)
>> +{
>> +	for (;;) {
>> +		if (node->rb_left)
>> +			node = node->rb_left;
>
> Assigning to an argument passed as const seems weird to me.  I would
> think it shouldn't compile but it does.  I guess my understanding of
> const is incomplete.
>

Ya, that is due to const's binding:
	const struct rb_node *node1; // the thing pointed to is const
	const struct rb_node node2;  // node is const
	struct rb_node *const node3; // node is const
	const struct rb_node *const node4; // both node and the thing
					   // pointed too are const

And so ends up being perfectly legal (I use the first case listed here).

>> +		else if (node->rb_right)
>> +			node = node->rb_right;
>> +		else
>> +			return (struct rb_node *)node;
>> +	}
>> +}
>> +
>> +struct rb_node *rb_next_postorder(const struct rb_node *node)
>> +{
>> +	const struct rb_node *parent;
>> +	if (!node)
>> +		return NULL;
>> +	parent = rb_parent(node);
>
> Again here.
>
> Seth
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ