[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 4/5] tmem: Pointless check of NULL against an array



>>> On 25.11.13 at 20:54, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> wrote:
> On Mon, Nov 25, 2013 at 05:19:32PM +0000, Andrew Cooper wrote:
>> On 25/11/13 17:00, Konrad Rzeszutek Wilk wrote:
>> > CID 1055632 tells us that we are comparing an array to a NULL
>> > which is indeed silly. Lets not do it.
>> >
>> > CC: Bob Liu <bob.liu@xxxxxxxxxx>
>> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
>> > ---
>> >  xen/common/tmem.c | 2 --
>> >  1 file changed, 2 deletions(-)
>> >
>> > diff --git a/xen/common/tmem.c b/xen/common/tmem.c
>> > index 3bc35fd..1ebed8a 100644
>> > --- a/xen/common/tmem.c
>> > +++ b/xen/common/tmem.c
>> > @@ -1798,8 +1798,6 @@ static int do_tmem_destroy_pool(uint32_t pool_id)
>> >      struct client *client = tmem_client_from_current();
>> >      struct tmem_pool *pool;
>> >  
>> > -    if ( client->pools == NULL )
>> > -        return 0;
>> 
>> client->pools certainly can't be null, but client certainly can.  This
>> should be "if ( !client )"
> 
> No need. The caller of this function does that already and if there
> does not exist one - it will create one.
> 
> I can add an ASSERT here?

Yes. Or just pass the already validated "client" into the function.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.