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

Re: [Xen-devel] [PATCH 1/3] tools/libxc: Drop xc_cpuid_to_str()



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.cooper3@xxxxxxxxxx>

Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> @@ -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.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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