diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-08-12 13:29:57 +0000 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2005-08-12 13:29:57 +0000 |
commit | e11ff5a682b7e6ac34b756b76bc738e417396277 (patch) | |
tree | 71ad2ee938006de84a0f53de2015d1bbe27e5f05 | |
parent | 12313bf29fc0088ea31eb65dcdd5af4e4851b03a (diff) | |
parent | e08e53f1512f23a00b95f68bff95667ffec86df4 (diff) | |
download | xen-e11ff5a682b7e6ac34b756b76bc738e417396277.tar.gz xen-e11ff5a682b7e6ac34b756b76bc738e417396277.tar.bz2 xen-e11ff5a682b7e6ac34b756b76bc738e417396277.zip |
merge
-rw-r--r-- | tools/libxc/Makefile | 2 | ||||
-rw-r--r-- | tools/libxc/xc_core.c | 7 | ||||
-rw-r--r-- | tools/libxc/xc_linux_build.c | 15 | ||||
-rw-r--r-- | tools/libxc/xc_linux_restore.c | 11 | ||||
-rw-r--r-- | tools/libxc/xc_linux_save.c | 27 | ||||
-rw-r--r-- | tools/libxc/xc_load_elf.c | 3 | ||||
-rw-r--r-- | tools/libxc/xc_ptrace.c | 2 | ||||
-rw-r--r-- | tools/libxc/xc_vmx_build.c | 14 |
8 files changed, 29 insertions, 52 deletions
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 81fcdc2750..41b024d273 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -7,7 +7,7 @@ INSTALL_DIR = $(INSTALL) -d -m0755 MAJOR = 3.0 MINOR = 0 -CC = gcc +CC = sparse XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c index 653512ab92..df4352de1c 100644 --- a/tools/libxc/xc_core.c +++ b/tools/libxc/xc_core.c @@ -43,7 +43,7 @@ xc_domain_dumpcore(int xc_handle, goto error_out; } - if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == 0) { + if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == NULL) { PERROR("Could not allocate dump_mem"); goto error_out; } @@ -108,9 +108,8 @@ xc_domain_dumpcore(int xc_handle, free(dump_mem_start); return 0; error_out: - if (dump_fd) + if (dump_fd != -1) close(dump_fd); - if (dump_mem_start) - free(dump_mem_start); + free(dump_mem_start); return -1; } diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index 48cace5647..45044c0735 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -318,8 +318,7 @@ static int setup_guest(int xc_handle, return 0; error_out: - if ( page_array != NULL ) - free(page_array); + free(page_array); return -1; } #else /* x86 */ @@ -616,10 +615,8 @@ static int setup_guest(int xc_handle, return 0; error_out: - if ( mmu != NULL ) - free(mmu); - if ( page_array != NULL ) - free(page_array); + free(mmu); + free(page_array); return -1; } #endif @@ -719,8 +716,7 @@ int xc_linux_build(int xc_handle, close(initrd_fd); if ( initrd_gfd ) gzclose(initrd_gfd); - if ( image != NULL ) - free(image); + free(image); #ifdef __ia64__ /* based on new_thread in xen/arch/ia64/domain.c */ @@ -806,8 +802,7 @@ int xc_linux_build(int xc_handle, gzclose(initrd_gfd); else if ( initrd_fd >= 0 ) close(initrd_fd); - if ( image != NULL ) - free(image); + free(image); return -1; } diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c index c2bce43910..67d5607e77 100644 --- a/tools/libxc/xc_linux_restore.c +++ b/tools/libxc/xc_linux_restore.c @@ -32,7 +32,7 @@ #define PPRINTF(_f, _a...) #endif -ssize_t +static ssize_t read_exact(int fd, void *buf, size_t count) { int r = 0, s; @@ -607,12 +607,9 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns, out: if ( (rc != 0) && (dom != 0) ) xc_domain_destroy(xc_handle, dom); - if ( mmu != NULL ) - free(mmu); - if ( pfn_to_mfn_table != NULL ) - free(pfn_to_mfn_table); - if ( pfn_type != NULL ) - free(pfn_type); + free(mmu); + free(pfn_to_mfn_table); + free(pfn_type); DPRINTF("Restore exit with rc=%d\n", rc); return rc; diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c index c2a6af5f13..77349c88a3 100644 --- a/tools/libxc/xc_linux_save.c +++ b/tools/libxc/xc_linux_save.c @@ -136,7 +136,7 @@ static long long tv_to_us( struct timeval *new ) return (new->tv_sec * 1000000) + new->tv_usec; } -static long long llgettimeofday() +static long long llgettimeofday( void ) { struct timeval now; gettimeofday(&now, NULL); @@ -312,9 +312,9 @@ static int analysis_phase( int xc_handle, u32 domid, } -int suspend_and_state(int xc_handle, int io_fd, int dom, - xc_dominfo_t *info, - vcpu_guest_context_t *ctxt) +static int suspend_and_state(int xc_handle, int io_fd, int dom, + xc_dominfo_t *info, + vcpu_guest_context_t *ctxt) { int i=0; char ans[30]; @@ -1051,20 +1051,11 @@ int xc_linux_save(int xc_handle, int io_fd, u32 dom) if(live_mfn_to_pfn_table) munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024); - if (pfn_type != NULL) - free(pfn_type); - - if (pfn_batch != NULL) - free(pfn_batch); - - if (to_send != NULL) - free(to_send); - - if (to_fix != NULL) - free(to_fix); - - if (to_skip != NULL) - free(to_skip); + free(pfn_type); + free(pfn_batch); + free(to_send); + free(to_fix); + free(to_skip); DPRINTF("Save exit rc=%d\n",rc); return !!rc; diff --git a/tools/libxc/xc_load_elf.c b/tools/libxc/xc_load_elf.c index 926db3a964..90417fb2ca 100644 --- a/tools/libxc/xc_load_elf.c +++ b/tools/libxc/xc_load_elf.c @@ -309,8 +309,7 @@ loadelfsymtab( dsi->v_end = round_pgup(maxva); out: - if ( p != NULL ) - free(p); + free(p); return 0; } diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c index 2b53f460cf..fdeca60e2e 100644 --- a/tools/libxc/xc_ptrace.c +++ b/tools/libxc/xc_ptrace.c @@ -221,7 +221,7 @@ map_domain_va(unsigned long domid, int cpu, void * guest_va, int perm) return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK)); error_out: - return 0; + return NULL; } int diff --git a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c index 9836746919..f10cc8391c 100644 --- a/tools/libxc/xc_vmx_build.c +++ b/tools/libxc/xc_vmx_build.c @@ -616,17 +616,15 @@ static int setup_guest(int xc_handle, return 0; error_out: - if ( mmu != NULL ) - free(mmu); - if ( page_array != NULL ) - free(page_array); + free(mmu); + free(page_array); return -1; } #define VMX_FEATURE_FLAG 0x20 -int vmx_identify(void) +static int vmx_identify(void) { int eax, ecx; @@ -745,8 +743,7 @@ int xc_vmx_build(int xc_handle, close(initrd_fd); if ( initrd_gfd ) gzclose(initrd_gfd); - if ( image != NULL ) - free(image); + free(image); ctxt->flags = VGCF_VMX_GUEST; /* FPU is set up to default initial state. */ @@ -801,8 +798,7 @@ int xc_vmx_build(int xc_handle, gzclose(initrd_gfd); else if ( initrd_fd >= 0 ) close(initrd_fd); - if ( image != NULL ) - free(image); + free(image); return -1; } |