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

[xen master] tools/libxc: Drop copy-in in xc_physinfo()



commit 06cc1f886f323394004190f931266ab328ec8773
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Dec 23 16:10:15 2021 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Jan 5 09:44:26 2022 +0000

    tools/libxc: Drop copy-in in xc_physinfo()
    
    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@xxxxxxxxxx>
    Reviewed-by: Wei Chen <Wei.Chen@xxxxxxx>
    Acked-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
 tools/libs/ctrl/xc_misc.c | 2 --
 tools/libs/light/libxl.c  | 2 +-
 tools/libs/stat/xenstat.c | 2 +-
 tools/misc/xenpm.c        | 2 +-
 tools/xenmon/xenbaked.c   | 2 +-
 tools/xentrace/xentrace.c | 2 +-
 6 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 3820394413..265f15ec2d 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -195,8 +195,6 @@ int xc_physinfo(xc_interface *xch,
 
     sysctl.cmd = XEN_SYSCTL_physinfo;
 
-    memcpy(&sysctl.u.physinfo, put_info, sizeof(*put_info));
-
     if ( (ret = do_sysctl(xch, &sysctl)) != 0 )
         return ret;
 
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index a77aa856fd..667ae6409b 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -351,7 +351,7 @@ const char *libxl_defbool_to_string(libxl_defbool b)
 
/******************************************************************************/
 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);
diff --git a/tools/libs/stat/xenstat.c b/tools/libs/stat/xenstat.c
index e49689aa2d..8bab2e66a7 100644
--- a/tools/libs/stat/xenstat.c
+++ b/tools/libs/stat/xenstat.c
@@ -135,7 +135,7 @@ xenstat_node *xenstat_get_node(xenstat_handle * handle, 
unsigned int flags)
 {
 #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;
diff --git a/tools/misc/xenpm.c b/tools/misc/xenpm.c
index d0191d4984..4f8cde690a 100644
--- a/tools/misc/xenpm.c
+++ b/tools/misc/xenpm.c
@@ -1244,7 +1244,7 @@ struct {
 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)];
 
diff --git a/tools/xenmon/xenbaked.c b/tools/xenmon/xenbaked.c
index 1ed34334c8..7591de7c60 100644
--- a/tools/xenmon/xenbaked.c
+++ b/tools/xenmon/xenbaked.c
@@ -436,7 +436,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, 
unsigned int num,
  */
 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;
 
diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index a8903ebf46..864e30d50c 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -589,7 +589,7 @@ static void set_evt_mask(uint32_t mask)
  */
 static unsigned int get_num_cpus(void)
 {
-    xc_physinfo_t physinfo = { 0 };
+    xc_physinfo_t physinfo;
     int ret;
     
     ret = xc_physinfo(xc_handle, &physinfo);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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