xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Artem Mygaiev <joculator@gmail.com>, xen-devel@lists.xenproject.org
Cc: Artem Mygaiev <artem_mygaiev@epam.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [Xen-devel] [PATCH 1/3] Consistent use for lock variable
Date: Sat, 18 Jan 2020 13:09:03 +0000	[thread overview]
Message-ID: <51fd5546-b0aa-2d37-4d26-51484dd3cde8@xen.org> (raw)
In-Reply-To: <5eec779f850fec88caeb67a090a25092792689ba.1570628924.git.artem_mygaiev@epam.com>

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@epam.com>

Acked-by: Julien Grall <julien@xen.org>

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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2020-01-18 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 14:20 [Xen-devel] [PATCH 0/3] Minor Coverity fixes Artem Mygaiev
2019-10-09 14:20 ` [Xen-devel] [PATCH 1/3] Consistent use for lock variable Artem Mygaiev
2020-01-18 13:09   ` Julien Grall [this message]
2019-10-09 14:20 ` [Xen-devel] [PATCH 2/3] Remove useless ASSERT condition Artem Mygaiev
2019-10-09 14:56   ` Julien Grall
2020-01-18 12:58     ` Julien Grall
2019-10-09 14:20 ` [Xen-devel] [PATCH 3/3] Free allocated resource on error Artem Mygaiev
2019-10-09 15:24   ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51fd5546-b0aa-2d37-4d26-51484dd3cde8@xen.org \
    --to=julien@xen.org \
    --cc=artem_mygaiev@epam.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=joculator@gmail.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).