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: <20170925134708.GA14314@infradead.org>
Date:   Mon, 25 Sep 2017 06:47:08 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Rik van Riel <riel@...riel.com>
Cc:     Gargi Sharma <gs051095@...il.com>, linux-kernel@...r.kernel.org,
        julia.lawall@...6.fr, akpm@...ux-foundation.org, mingo@...nel.org,
        pasha.tatashin@...cle.com, ktkhai@...tuozzo.com, oleg@...hat.com
Subject: Re: [PATCH 2/4] idr: Add a function idr_get()

On Mon, Sep 25, 2017 at 09:20:07AM -0400, Rik van Riel wrote:
> > +++ b/lib/idr.c
> > @@ -135,6 +135,17 @@ void *idr_get_next_ext(struct idr *idr, unsigned
> > long *nextid)
> >  }
> >  EXPORT_SYMBOL(idr_get_next_ext);
> >  
> > +void * idr_get(struct idr *idr, int *id)
> > +{
> > +	struct radix_tree_node *node;
> > +	void __rcu **slot = NULL;
> > +
> > +	__radix_tree_lookup(&idr->idr_rt, *id, &node, &slot);
> > +	if (!slot)
> > +		return NULL;
> > +	return node;
> > +}
> 
> I should have noticed this (much) earlier, but doesn't idr_get do
> essentially the same thing as idr_find?
> 
> Also, wouldn't you want to return the pid pointer from slot,
> rather than a pointer to the entire radix tree node?

It also seems rather odd to pass id by reference here just to
dereference it a little later.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ