The first thing XEN_SYSCTL_physinfo does is zero op->u.physinfo.
Do not copy-in. It's pointless, and most callers don't initialise their
xc_physinfo_t buffer to begin with. Remove the redundant zeroing from the
remaining callers.
Spotted by Coverity.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Chen <Wei.Chen@arm.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
sysctl.cmd = XEN_SYSCTL_physinfo;
- memcpy(&sysctl.u.physinfo, put_info, sizeof(*put_info));
-
if ( (ret = do_sysctl(xch, &sysctl)) != 0 )
return ret;
/******************************************************************************/
int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo)
{
- xc_physinfo_t xcphysinfo = { 0 };
+ xc_physinfo_t xcphysinfo;
int rc;
long l;
GC_INIT(ctx);
{
#define DOMAIN_CHUNK_SIZE 256
xenstat_node *node;
- xc_physinfo_t physinfo = { 0 };
+ xc_physinfo_t physinfo;
xc_domaininfo_t domaininfo[DOMAIN_CHUNK_SIZE];
int new_domains;
unsigned int i;
int main(int argc, char *argv[])
{
int i, ret = 0;
- xc_physinfo_t physinfo = { 0 };
+ xc_physinfo_t physinfo;
int nr_matches = 0;
int matches_main_options[ARRAY_SIZE(main_options)];
*/
static unsigned int get_num_cpus(void)
{
- xc_physinfo_t physinfo = { 0 };
+ xc_physinfo_t physinfo;
xc_interface *xc_handle = xc_interface_open(0,0,0);
int ret;
*/
static unsigned int get_num_cpus(void)
{
- xc_physinfo_t physinfo = { 0 };
+ xc_physinfo_t physinfo;
int ret;
ret = xc_physinfo(xc_handle, &physinfo);