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-next>] [day] [month] [year] [list]
Message-ID: <1537962368-14019-1-git-send-email-zhongjiang@huawei.com>
Date:   Wed, 26 Sep 2018 19:46:08 +0800
From:   zhong jiang <zhongjiang@...wei.com>
To:     <paulus@...ba.org>, <benh@...nel.crashing.org>,
        <mpe@...erman.id.au>
CC:     <linuxppc-dev@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] powerpc: Move a dereference below a NULL test

It is safe to move dereference below a NULL test.

Signed-off-by: zhong jiang <zhongjiang@...wei.com>
---
 arch/powerpc/kernel/cacheinfo.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index a8f20e5..7f19714 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -401,14 +401,13 @@ static struct cache *cache_lookup_or_instantiate(struct device_node *node,
 	struct cache *cache;
 
 	cache = cache_lookup_by_node(node);
+	if (!cache)
+		cache = cache_do_one_devnode(node, level);
 
 	WARN_ONCE(cache && cache->level != level,
 		  "cache level mismatch on lookup (got %d, expected %d)\n",
 		  cache->level, level);
 
-	if (!cache)
-		cache = cache_do_one_devnode(node, level);
-
 	return cache;
 }
 
-- 
1.7.12.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ