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 <[email protected]>
Signed-off-by: yu kuai <[email protected]>
---
 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

Reply via email to