[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1565700638-67200-1-git-send-email-yukuai3@huawei.com>
Date: Tue, 13 Aug 2019 20:50:38 +0800
From: yu kuai <yukuai3@...wei.com>
To: <mark@...heh.com>, <jlbec@...lplan.org>,
<ocfs2-devel@....oracle.com>, <linux-kernel@...r.kernel.org>
CC: <yi.zhang@...wei.com>, <yukuai3@...wei.com>
Subject: [PATCH] ocfs2: need to check return value from kobject_set_name()
Since kobject_set_name() might return an error, the return value need to
be checked, otherwise there will be a warn:
mlog_sys_init
kset_register
kobject_add_internal
if (!kobj->name || !kobj->name[0]) {
WARN(...);
return -EINVAL;
}
Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: yu kuai <yukuai3@...wei.com>
---
fs/ocfs2/cluster/masklog.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index d331c23..4fcef46 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -178,7 +178,8 @@ int mlog_sys_init(struct kset *o2cb_kset)
}
mlog_attr_ptrs[i] = NULL;
- kobject_set_name(&mlog_kset.kobj, "logmask");
+ if (!kobject_set_name(&mlog_kset.kobj, "logmask"))
+ return -EINVAL;
mlog_kset.kobj.kset = o2cb_kset;
return kset_register(&mlog_kset);
}
--
2.7.4
Powered by blists - more mailing lists