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]
Message-Id: <984a112e60904a7bbbe046c5d9d2c1f10dfe02b6.1472559626.git.geliangtang@gmail.com>
Date:   Tue, 30 Aug 2016 20:24:43 +0800
From:   Geliang Tang <geliangtang@...il.com>
To:     Anton Vorontsov <anton@...msg.org>,
        Colin Cross <ccross@...roid.com>,
        Kees Cook <keescook@...omium.org>,
        Tony Luck <tony.luck@...el.com>
Cc:     Geliang Tang <geliangtang@...il.com>, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] ramoops: use buffer_size() and buffer_start()

Since buffer_size() and buffer_start() have been defined in ram_core.c,
use them instead of open-coding.

Signed-off-by: Geliang Tang <geliangtang@...il.com>
---
 fs/pstore/ram_core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index 76c3f80..a8500cd 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -54,7 +54,7 @@ static size_t buffer_start_add_atomic(struct persistent_ram_zone *prz, size_t a)
 	int new;
 
 	do {
-		old = atomic_read(&prz->buffer->start);
+		old = buffer_start(prz);
 		new = old + a;
 		while (unlikely(new >= prz->buffer_size))
 			new -= prz->buffer_size;
@@ -69,11 +69,11 @@ static void buffer_size_add_atomic(struct persistent_ram_zone *prz, size_t a)
 	size_t old;
 	size_t new;
 
-	if (atomic_read(&prz->buffer->size) == prz->buffer_size)
+	if (buffer_size(prz) == prz->buffer_size)
 		return;
 
 	do {
-		old = atomic_read(&prz->buffer->size);
+		old = buffer_size(prz);
 		new = old + a;
 		if (new > prz->buffer_size)
 			new = prz->buffer_size;
@@ -91,7 +91,7 @@ static size_t buffer_start_add_locked(struct persistent_ram_zone *prz, size_t a)
 
 	raw_spin_lock_irqsave(&buffer_lock, flags);
 
-	old = atomic_read(&prz->buffer->start);
+	old = buffer_start(prz);
 	new = old + a;
 	while (unlikely(new >= prz->buffer_size))
 		new -= prz->buffer_size;
@@ -111,7 +111,7 @@ static void buffer_size_add_locked(struct persistent_ram_zone *prz, size_t a)
 
 	raw_spin_lock_irqsave(&buffer_lock, flags);
 
-	old = atomic_read(&prz->buffer->size);
+	old = buffer_size(prz);
 	if (old == prz->buffer_size)
 		goto exit;
 
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ