Unverified Commit 5a6a4ae9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!8010 mm/mempolicy.c: fix the out-of-bounds access issue in mpol_parse_str

parents 45c4db5b e85c21ba
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1477,7 +1477,8 @@ static inline int sanitize_mpol_flags(int *mode, unsigned short *flags)
	*flags = *mode & MPOL_MODE_FLAGS;
	*mode &= ~MPOL_MODE_FLAGS;

	if ((unsigned int)(*mode) >=  MPOL_MAX)
	if ((unsigned int)(*mode) >=  MPOL_MAX ||
	    (unsigned int)(*mode) == MPOL_WEIGHTED_INTERLEAVE)
		return -EINVAL;
	if ((*flags & MPOL_F_STATIC_NODES) && (*flags & MPOL_F_RELATIVE_NODES))
		return -EINVAL;
@@ -2989,6 +2990,7 @@ static const char * const policy_modes[] =
	[MPOL_PREFERRED]  = "prefer",
	[MPOL_BIND]       = "bind",
	[MPOL_INTERLEAVE] = "interleave",
	[MPOL_WEIGHTED_INTERLEAVE] = "weighted interleave",
	[MPOL_LOCAL]      = "local",
	[MPOL_PREFERRED_MANY]  = "prefer (many)",
};