All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: tim@xen.org
Subject: [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h
Date: Thu, 12 Jan 2012 11:20:06 -0500	[thread overview]
Message-ID: <e7028b298fe384d1c044.1326385206@xdev.gridcentric.ca> (raw)

 xen/arch/x86/mm/mm-locks.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


In an order-enforcing wrapper for an "external" recursive lock,
we aim to increment/decrement a recurse count and only update the
lock ordering on zero counts.

Unfortunately we incrementing/decrementing the pointer to the
recurse count, rather than the count itself.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>

diff -r 91f9a26a8d94 -r e7028b298fe3 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h
+++ b/xen/arch/x86/mm/mm-locks.h
@@ -81,7 +81,7 @@ static inline void _mm_enforce_order_loc
 {
     if ( recurse_count )
     {
-        if ( *recurse_count++ == 0 )
+        if ( (*recurse_count)++ == 0 )
         {
             *unlock_level = __get_lock_level();
         }
@@ -125,7 +125,7 @@ static inline void mm_enforce_order_unlo
     if ( recurse_count )
     {
         BUG_ON(*recurse_count == 0);
-        if ( *recurse_count-- == 1 )
+        if ( (*recurse_count)-- == 1 )
         {
             __set_lock_level(unlock_level);
         }

             reply	other threads:[~2012-01-12 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12 16:20 Andres Lagar-Cavilla [this message]
2012-01-12 16:41 ` [PATCH] x86/mm: Fix operator associativity bug in mm-locks.h Tim Deegan

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=e7028b298fe384d1c044.1326385206@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.