On 02/07/18 11:41, Roger Pau Monné wrote: > On Mon, Jul 02, 2018 at 10:57:25AM +0100, Andrew Cooper wrote: >> This helper appears to have been introduced 10 years ago by c/s 5f14a87ceb >> "x86, hvm: Guest CPUID configuration" and never had any users at all. >> >> alloc_str() is actually an opencoded calloc(), and now only has a single >> caller. Use calloc() directly and drop alloc_str(). >> >> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> > Reviewed-by: Roger Pau Monné <roger....@citrix.com>
Thanks, > >> @@ -832,7 +809,7 @@ int xc_cpuid_set( >> continue; >> } >> >> - config_transformed[i] = alloc_str(); >> + config_transformed[i] = calloc(33, 1); /* 32 bits, NUL terminator. >> */ > I would rather do sizeof(*config_transformed[i]), but I'm not going to > insist. Without a structure of the form: struct { char cfg[33]; }; not amount of sizeof trickery will work here. Your example reduces to sizeof(char), rather than 32/33. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel