diff mbox

[8/8] tools/xenalyze: Actually handle case where number of ipi vectors exceeds static max

Message ID 1456411743-17741-9-git-send-email-george.dunlap@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

George Dunlap Feb. 25, 2016, 2:49 p.m. UTC
find_vec() is supposed to find the vector in the list if it exists,
choose an empty slot if it doesn't exist, and return null if all slots
are full.

However, coverity noticed that although the callers of find_vec() handle
the last condition, find_vec() itself didn't.

Check to see if we actually found an empty slot before attempting to
initialize it.

CID 1306864

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
---
 tools/xentrace/xenalyze.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ian Jackson Feb. 26, 2016, 12:34 p.m. UTC | #1
George Dunlap writes ("[PATCH 8/8] tools/xenalyze: Actually handle case where number of ipi vectors exceeds static max"):
> find_vec() is supposed to find the vector in the list if it exists,
> choose an empty slot if it doesn't exist, and return null if all slots
> are full.
> 
> However, coverity noticed that although the callers of find_vec() handle
> the last condition, find_vec() itself didn't.
> 
> Check to see if we actually found an empty slot before attempting to
> initialize it.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Konrad Rzeszutek Wilk Feb. 29, 2016, 4:16 p.m. UTC | #2
On Fri, Feb 26, 2016 at 12:34:56PM +0000, Ian Jackson wrote:
> George Dunlap writes ("[PATCH 8/8] tools/xenalyze: Actually handle case where number of ipi vectors exceeds static max"):
> > find_vec() is supposed to find the vector in the list if it exists,
> > choose an empty slot if it doesn't exist, and return null if all slots
> > are full.
> > 
> > However, coverity noticed that although the callers of find_vec() handle
> > the last condition, find_vec() itself didn't.
> > 
> > Check to see if we actually found an empty slot before attempting to
> > initialize it.
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

applied.
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 4ae50b8..47fef36 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -3547,7 +3547,7 @@  struct outstanding_ipi *find_vec(struct vlapic_struct *vla, int vec)
             o = vla->outstanding.list + i;
     }
 
-    if(!o->valid) {
+    if(o && !o->valid) {
         o->vec = vec;
         o->valid = 1;
     }