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>] [day] [month] [year] [list]
Message-Id: <1639388586-63750-1-git-send-email-wangqing@vivo.com>
Date:   Mon, 13 Dec 2021 01:43:06 -0800
From:   Qing Wang <wangqing@...o.com>
To:     "David S. Miller" <davem@...emloft.net>,
        sparclinux@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Wang Qing <wangqing@...o.com>
Subject: [PATCH] arch: sparc: add missing of_node_put before return

From: Wang Qing <wangqing@...o.com>

Fix following coccicheck warning:
WARNING: Function "for_each_node_by_type" 
should have of_node_put() before return.

Early exits from for_each_node_by_type should decrement the
node reference counter.

Signed-off-by: Wang Qing <wangqing@...o.com>
---
 arch/sparc/kernel/prom_64.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index f883a50..ed3e987
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -460,8 +460,10 @@ static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int),
 		}
 #endif
 		ret = func(dp, cpuid, arg);
-		if (ret)
+		if (ret) {
+			of_node_put(dp);
 			return ret;
+		}
 	}
 	return NULL;
 }
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ