[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_vm
Ian Campbell writes ("[Xen-devel] [PATCH] libxl: correct allocation size in libxl_list_vm"): > libxl: correct allocation size in libxl_list_vm Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> > *ptr has type libxl_vminfo not libxl_domid, so correct calloc call. > > This the second instance of this bug I've noticed recently, I did a > quick audit of other similar uses of sizeof(...) and all I spotted > were a couple of harmlessly reversed calloc arguments. It's a pretty > strong argument for "foo = ..alloc(sizeof(*foo))" rather than > "alloc(sizeof(foos_type))" though... The correct approach to this is to make a macro along these lines: #define OUR_CALLOC(foo) ((foo)=calloc(sizeof(*(foo)))) I think we may have some of these but we should have a complete set. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |