Unverified Commit d89af4ae authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files
parents 89f4c0a8 a7af9966
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -2205,11 +2205,17 @@ static int ocfs2_initialize_super(struct super_block *sb,
	}

	if (ocfs2_clusterinfo_valid(osb)) {
		/*
		 * ci_stack and ci_cluster in ocfs2_cluster_info may not be null
		 * terminated, so make sure no overflow happens here by using
		 * memcpy. Destination strings will always be null terminated
		 * because osb is allocated using kzalloc.
		 */
		osb->osb_stackflags =
			OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags;
		strlcpy(osb->osb_cluster_stack,
		memcpy(osb->osb_cluster_stack,
		       OCFS2_RAW_SB(di)->s_cluster_info.ci_stack,
		       OCFS2_STACK_LABEL_LEN + 1);
		       OCFS2_STACK_LABEL_LEN);
		if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) {
			mlog(ML_ERROR,
			     "couldn't mount because of an invalid "
@@ -2218,9 +2224,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
			status = -EINVAL;
			goto bail;
		}
		strlcpy(osb->osb_cluster_name,
		memcpy(osb->osb_cluster_name,
			OCFS2_RAW_SB(di)->s_cluster_info.ci_cluster,
			OCFS2_CLUSTER_NAME_LEN + 1);
			OCFS2_CLUSTER_NAME_LEN);
	} else {
		/* The empty string is identical with classic tools that
		 * don't know about s_cluster_info. */