[Xen-devel] [PATCH] xen/privcmd: remove unused variable pageidx

2017-11-08 Thread Colin King
From: Colin Ian King 

Variable pageidx is assigned a value but it is never read, hence it
is redundant and can be removed. Cleans up clang warning:

drivers/xen/privcmd.c:199:2: warning: Value stored to 'pageidx'
is never read

Signed-off-by: Colin Ian King 
---
 drivers/xen/privcmd.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index feca75b07fdd..1c909183c42a 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -191,13 +191,10 @@ static int traverse_pages_block(unsigned nelem, size_t 
size,
void *state)
 {
void *pagedata;
-   unsigned pageidx;
int ret = 0;
 
BUG_ON(size > PAGE_SIZE);
 
-   pageidx = PAGE_SIZE;
-
while (nelem) {
int nr = (PAGE_SIZE/size);
struct page *page;
-- 
2.14.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] xen/pvcalls: remove redundant check for irq >= 0

2017-11-03 Thread Colin King
From: Colin Ian King 

This is a moot point, but irq is always less than zero at the label
out_error, so the check for irq >= 0 is redundant and can be removed.

Detected by CoverityScan, CID#1460371 ("Logically dead code")

Fixes: cb1c7d9bbc87 ("xen/pvcalls: implement connect command")
Signed-off-by: Colin Ian King 
---
 drivers/xen/pvcalls-front.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index de8a470351a5..b08569998046 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -351,9 +351,7 @@ static int create_active(struct sock_mapping *map, int 
*evtchn)
return 0;
 
 out_error:
-   if (irq >= 0)
-   unbind_from_irqhandler(irq, map);
-   else if (*evtchn >= 0)
+   if (*evtchn >= 0)
xenbus_free_evtchn(pvcalls_front_dev, *evtchn);
kfree(map->active.data.in);
kfree(map->active.ring);
-- 
2.14.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] xen/pvcalls: fix unsigned less than zero error check

2017-11-03 Thread Colin King
From: Colin Ian King 

The check on bedata->ref is never true because ref is an unsigned
integer. Fix this by assigning signed int ret to the return of the
call to gnttab_claim_grant_reference so the -ve return can be checked.

Detected by CoverityScan, CID#1460358 ("Unsigned compared against 0")

Fixes: 219681909913 ("xen/pvcalls: connect to the backend")
Signed-off-by: Colin Ian King 
---
 drivers/xen/pvcalls-front.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index 0c1ec6894cc4..de8a470351a5 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -1186,11 +1186,10 @@ static int pvcalls_front_probe(struct xenbus_device 
*dev,
ret = gnttab_alloc_grant_references(1, _head);
if (ret < 0)
goto error;
-   bedata->ref = gnttab_claim_grant_reference(_head);
-   if (bedata->ref < 0) {
-   ret = bedata->ref;
+   ret = gnttab_claim_grant_reference(_head);
+   if (ret < 0)
goto error;
-   }
+   bedata->ref = ret;
gnttab_grant_foreign_access_ref(bedata->ref, dev->otherend_id,
virt_to_gfn((void *)sring), 0);
 
-- 
2.14.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH][V2] x86/xen: clean up clang build warning

2017-09-18 Thread Colin King
From: Colin Ian King 

In the case where sizeof(maddr) != sizeof(long) p is initialized and
never read and clang throws a warning on this.  Move declaration of
p to clean up the clang build warning:

warning: Value stored to 'p' during its initialization is never read

Signed-off-by: Colin Ian King 
---
 arch/x86/include/asm/xen/hypercall.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/xen/hypercall.h 
b/arch/x86/include/asm/xen/hypercall.h
index 9606688caa4b..5ff77cb2529e 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -552,13 +552,13 @@ static inline void
 MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
struct desc_struct desc)
 {
-   u32 *p = (u32 *) 
-
mcl->op = __HYPERVISOR_update_descriptor;
if (sizeof(maddr) == sizeof(long)) {
mcl->args[0] = maddr;
mcl->args[1] = *(unsigned long *)
} else {
+   u32 *p = (u32 *)
+
mcl->args[0] = maddr;
mcl->args[1] = maddr >> 32;
mcl->args[2] = *p++;
-- 
2.14.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86/xen: clean up clang build warning

2017-09-18 Thread Colin King
From: Colin Ian King 

In the case where sizeof(maddr) != sizeof(long) p is initialized and
never read and clang throws a warning on this.  Move declaration of
p to clean up the clang build warning:

warning: Value stored to 'p' during its initialization is never read

Signed-off-by: Colin Ian King 
---
 arch/x86/include/asm/xen/hypercall.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/xen/hypercall.h 
b/arch/x86/include/asm/xen/hypercall.h
index 9606688caa4b..5ff77cb2529e 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -552,13 +552,13 @@ static inline void
 MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
struct desc_struct desc)
 {
-   u32 *p = (u32 *) 
-
mcl->op = __HYPERVISOR_update_descriptor;
if (sizeof(maddr) == sizeof(long)) {
mcl->args[0] = maddr;
mcl->args[1] = *(unsigned long *)
} else {
+   u32 *p = (u32 *) 
+
mcl->args[0] = maddr;
mcl->args[1] = maddr >> 32;
mcl->args[2] = *p++;
-- 
2.14.1


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH][xen-next] xen/pvcalls: fix null pointer reference on sock_release call

2017-07-11 Thread Colin King
From: Colin Ian King 

Currently a sock_release on map->sock will result in a null pointer
deference on map when map is null. Instead, the sock_relase sould
be on sock and not map->sock.

Detected by CoverityScan, CID#1450169 ("Dereference after null check")

Fixes: b535e2b9b78a ("xen/pvcalls: implement connect command")
Signed-off-by: Colin Ian King 
---
 drivers/xen/pvcalls-back.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/pvcalls-back.c b/drivers/xen/pvcalls-back.c
index d6c4c4aecb41..01b690e1e555 100644
--- a/drivers/xen/pvcalls-back.c
+++ b/drivers/xen/pvcalls-back.c
@@ -424,7 +424,7 @@ static int pvcalls_back_connect(struct xenbus_device *dev,
sock);
if (!map) {
ret = -EFAULT;
-   sock_release(map->sock);
+   sock_release(sock);
}
 
 out:
-- 
2.11.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86/xen: add missing \n at end of printk warning message

2016-09-12 Thread Colin King
From: Colin Ian King 

The message is missing a \n, add it.

Signed-off-by: Colin Ian King 
---
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/platform-pci-unplug.c 
b/arch/x86/xen/platform-pci-unplug.c
index d37a0c7..90d1b83 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -61,7 +61,7 @@ static int check_platform_magic(void)
}
break;
default:
-   printk(KERN_WARNING "Xen Platform PCI: unknown I/O protocol 
version");
+   printk(KERN_WARNING "Xen Platform PCI: unknown I/O protocol 
version\n");
return XEN_PLATFORM_ERR_PROTOCOL;
}
 
-- 
2.9.3


___
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel


[Xen-devel] [PATCH] x86/xen/p2m: trivia indentation fix on if statement

2016-01-18 Thread Colin King
From: Colin Ian King 

if statement is indented by 1 extra whitespace, remove this

Signed-off-by: Colin Ian King 
---
 arch/x86/xen/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index cab9f76..17dbc1d 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -291,7 +291,7 @@ void __init xen_build_dynamic_phys_to_machine(void)
 {
unsigned long pfn;
 
-if (xen_feature(XENFEAT_auto_translated_physmap))
+   if (xen_feature(XENFEAT_auto_translated_physmap))
return;
 
xen_p2m_addr = (unsigned long *)xen_start_info->mfn_list;
-- 
2.7.0.rc3


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH] xen: fix non-ANSI function declaration of function xen_has_pv_devices

2015-07-16 Thread Colin King
From: Colin Ian King colin.k...@canonical.com

xen_has_pv_devices has no parameters, so use the normal void
parameter convention to make it match the prototype in the
header file include/xen/platform_pci.h

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/platform-pci-unplug.c 
b/arch/x86/xen/platform-pci-unplug.c
index a826171..9586ff3 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -68,7 +68,7 @@ static int check_platform_magic(void)
return 0;
 }
 
-bool xen_has_pv_devices()
+bool xen_has_pv_devices(void)
 {
if (!xen_domain())
return false;
-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH] xen: fix non-ANSI function declaration of function xen_has_pv_devices

2015-07-16 Thread Colin King
From: Colin Ian King colin.k...@canonical.com

xen_has_pv_devices has no parameters, so use the normal void
parameter convention to make it match the prototype in the
header file include/xen/platform_pci.h

Signed-off-by: Colin Ian King colin.k...@canonical.com
---
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/platform-pci-unplug.c 
b/arch/x86/xen/platform-pci-unplug.c
index a826171..9586ff3 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -68,7 +68,7 @@ static int check_platform_magic(void)
return 0;
 }
 
-bool xen_has_pv_devices()
+bool xen_has_pv_devices(void)
 {
if (!xen_domain())
return false;
-- 
2.1.4


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel