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]
Date:   Tue, 27 Jul 2021 22:32:12 +0800
From:   Qiao Yanbo <qiaoyanbo_310@....com>
To:     gregkh@...uxfoundation.org
Cc:     rafael@...nel.org, linux-kernel@...r.kernel.org,
        qiaoyanbo <qiaoyanbo_310@....com>
Subject: [PATCH] kobject: kobject_add_internal cleanup

From: qiaoyanbo <qiaoyanbo_310@....com>

parent assignment in "if" block only need to consider when parent is NULL.

Signed-off-by: qiaoyanbo <qiaoyanbo_310@....com>
---
 lib/kobject.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index ea53b30cf..d1f4b3411 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -241,10 +241,11 @@ static int kobject_add_internal(struct kobject *kobj)
 
 	/* join kset if set, use it as parent if we do not already have one */
 	if (kobj->kset) {
-		if (!parent)
+		if (!parent) {
 			parent = kobject_get(&kobj->kset->kobj);
+			kobj->parent = parent;
+		}
 		kobj_kset_join(kobj);
-		kobj->parent = parent;
 	}
 
 	pr_debug("kobject: '%s' (%p): %s: parent: '%s', set: '%s'\n",
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ