提交 f57af6df 编写于 作者: C Chunyan Zhang 提交者: Alexander Shishkin

stm class: Fix integer boundary checks for master range

Master IDs are of unsigned int type, yet in the configfs policy code
we're validating user's input against INT_MAX. This is both pointless
and misleading as the real limits are imposed by the stm device's
[sw_start..sw_end] (which are also limited by the spec to be no larger
than 2^16-1).

Clean this up by getting rid of the redundant comparisons.
Signed-off-by: NChunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: NLaurent Fert <laurent.fert@intel.com>
上级 e787bc46
......@@ -107,8 +107,7 @@ stp_policy_node_masters_store(struct config_item *item, const char *page,
goto unlock;
/* must be within [sw_start..sw_end], which is an inclusive range */
if (first > INT_MAX || last > INT_MAX || first > last ||
first < stm->data->sw_start ||
if (first > last || first < stm->data->sw_start ||
last > stm->data->sw_end) {
ret = -ERANGE;
goto unlock;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册