lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Jun 2016 13:06:04 -0700
From:	Davidlohr Bueso <dave@...olabs.net>
To:	peterz@...radead.org, mingo@...nel.org
Cc:	davem@...emloft.net, cw00.choi@...sung.com,
	dougthompson@...ssion.com, bp@...en8.de, mchehab@....samsung.com,
	gregkh@...uxfoundation.org, pfg@....com, jikos@...nel.org,
	hans.verkuil@...co.com, awalls@...metrocast.net,
	dledford@...hat.com, sean.hefty@...el.com, kys@...rosoft.com,
	heiko.carstens@...ibm.com, James.Bottomley@...senPartnership.com,
	sumit.semwal@...aro.org, schwidefsky@...ibm.com,
	linux-kernel@...r.kernel.org, dave@...olabs.net,
	Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 12/12] dma-buf/fence: Employ atomic_fetch_add

Now that we have fetch_add() we can stop using add_return() - num.

These are very similar to the existing OP-RETURN primitives we already
have, except they return the value of the atomic variable _before_
modification.

Cc: Sumit Semwal <sumit.semwal@...aro.org>
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
 drivers/dma-buf/fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c
index 7b05dbe9b296..a58da5da112c 100644
--- a/drivers/dma-buf/fence.c
+++ b/drivers/dma-buf/fence.c
@@ -47,7 +47,7 @@ static atomic_t fence_context_counter = ATOMIC_INIT(0);
 unsigned fence_context_alloc(unsigned num)
 {
 	BUG_ON(!num);
-	return atomic_add_return(num, &fence_context_counter) - num;
+	return atomic_fetch_add(num, &fence_context_counter);
 }
 EXPORT_SYMBOL(fence_context_alloc);
 
-- 
2.6.6

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ