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

Re: [Xen-devel] [PATCH 1/3] Consistent use for lock variable



Hi Artem,

Apologies for the late answer.

On 09/10/2019 15:20, Artem Mygaiev wrote:
... for both lock and unlock

I would suggest the following commit message:

xen/xsm: Use the same lock for lock and unlock

The function avc_reclaim_mode() is not using the same variable for locking and unlocking. While the underlying spinlock is the same, coverity will get confused and think the lock was not released.

Update the code to use the same variable for the lock and unlock part.


Coverity-ID: 1381840
Signed-off-by: Artem Mygaiev <artem_mygaiev@xxxxxxxx>

Acked-by: Julien Grall <julien@xxxxxxx>

We also need an hack from Daniel. @Daniel, are you happy with the change?

---
  xen/xsm/flask/avc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/xsm/flask/avc.c b/xen/xsm/flask/avc.c
index 87ea38b7a0..3a9507f62a 100644
--- a/xen/xsm/flask/avc.c
+++ b/xen/xsm/flask/avc.c
@@ -320,7 +320,7 @@ static inline int avc_reclaim_node(void)
          head = &avc_cache.slots[hvalue];
          lock = &avc_cache.slots_lock[hvalue];
- spin_lock_irqsave(&avc_cache.slots_lock[hvalue], flags);
+        spin_lock_irqsave(lock, flags);
          rcu_read_lock(&avc_rcu_lock);
          hlist_for_each_entry(node, next, head, list)
          {


Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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