Skip to contentSkip to conversation

VT-d: Correct order of parameters to memset() in setup_posted_irte()

PATCH In review Andrew Cooper 2 participants 2 messages Dec 10, 2015 – Dec 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VT-d: Correct order of parameters to memset() in setup_posted_irte()

Introduced in c/s 83ea9229 "vt-d: add API to update IRTE when VT-d PI is used". Spotted by Coverity.

---
CC: Jan Beulich <[email protected]>
CC: Feng Wu <[email protected]>
CC: Kevin Tian <[email protected]>

---
 xen/drivers/passthrough/vtd/intremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/passthrough/vtd/intremap.c +1 -1
index 0a48cd4..0ee3fb2 100644
@@ -910,7 +910,7 @@ static void setup_posted_irte(
     struct iremap_entry *new_ire, const struct iremap_entry *old_ire,
     const struct pi_desc *pi_desc, const uint8_t gvec)
 {
-    memset(new_ire, sizeof(*new_ire), 0);
+    memset(new_ire, 0, sizeof(*new_ire));
 
     /*
      * 'im' filed decides whether the irte is in posted format (with value 1)
Signature · 1 line
2.1.4
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines

-----Original Message-----
From: Andrew Cooper [mailto:[email protected]]
Sent: Friday, December 11, 2015 12:07 AM
To: Xen-devel <[email protected]>
Cc: Andrew Cooper <[email protected]>; Jan Beulich <[email protected]>; Wu, Feng <[email protected]>; Tian, Kevin <[email protected]>
Subject: [PATCH] VT-d: Correct order of parameters to memset() in setup_posted_irte()

Introduced in c/s 83ea9229 "vt-d: add API to update IRTE when VT-d PI is used". Spotted by Coverity.

---
CC: Jan Beulich <[email protected]>
CC: Feng Wu <[email protected]>
CC: Kevin Tian <[email protected]>

---
 xen/drivers/passthrough/vtd/intremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/drivers/passthrough/vtd/intremap.c +0 -0
index 0a48cd4..0ee3fb2 100644

xen/drivers/passthrough/vtd/intremap.c static void setup_posted_irte( · line 913

Quoted 5 lines
xen/drivers/passthrough/vtd/intremap.c +1 -1
@@ -910,7 +910,7 @@ static void setup_posted_irte(
     struct iremap_entry *new_ire, const struct iremap_entry *old_ire,
     const struct pi_desc *pi_desc, const uint8_t gvec)
 {
-    memset(new_ire, sizeof(*new_ire), 0);
+    memset(new_ire, 0, sizeof(*new_ire));

Thanks for the fix.

Thanks,
Feng

Quoted 5 lines
xen/drivers/passthrough/vtd/intremap.c +0 -1
     /*
      * 'im' filed decides whether the irte is in posted format (with value 1)
--

2.1.4