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

Re: [Xen-devel] [PATCH] Null pointer dereference at free_vm_area()



> 
> Hi,
> 
> I quickly look around where free_vm_area is called, and I cannot see any
> codepath that could benefit such a code cleanup nor find any that
> could lead to a NULL pointer pass to it.
> 
> I think you should provide a use for this patch if you want it to be
> applied.
> 
> Thanks,
> -- 
> Vincent Hanquez
> 
I think it's more stylish than functional nowadays. In a situations in which we 
call alloc_vm_area() more than once, and test for the return value of them all 
in one shot. It can maybe lead to a cleaner code, as shown in the
pseudocode bellow. 

a1 = alloc_vm_area()
a2 = alloc_vm_area()

if (!a1 || !a2){
        free_vm_area(a1);
        free_vm_area(a2);
        return;
}

Instead of:

a1 = alloc_vm_area();
if (!a1)
        return;
a2 = alloc_vm_area()
if (!a2){
        free_vm_area(a1);
        return;
}

But of course, it's mainly a matter of opinion.

-- 
glommer

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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