diff options
author | Chunyan Zhang <zhang.chunyan@linaro.org> | 2016-03-28 03:55:42 -0400 |
---|---|---|
committer | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2016-04-08 09:08:00 -0400 |
commit | f57af6df6af23c086cfe023896822200eee48dd1 (patch) | |
tree | ae00b00985d7547b8d1cdb30397d0ac14d793d5c | |
parent | e787bc463cc1fe3f51b0cd7bf540236318f69cf1 (diff) |
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: Chunyan Zhang <zhang.chunyan@linaro.org>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reviewed-by: Laurent Fert <laurent.fert@intel.com>
-rw-r--r-- | drivers/hwtracing/stm/policy.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/hwtracing/stm/policy.c b/drivers/hwtracing/stm/policy.c index 1db189657b2b..e8b50b1ac619 100644 --- a/drivers/hwtracing/stm/policy.c +++ b/drivers/hwtracing/stm/policy.c | |||
@@ -107,8 +107,7 @@ stp_policy_node_masters_store(struct config_item *item, const char *page, | |||
107 | goto unlock; | 107 | goto unlock; |
108 | 108 | ||
109 | /* must be within [sw_start..sw_end], which is an inclusive range */ | 109 | /* must be within [sw_start..sw_end], which is an inclusive range */ |
110 | if (first > INT_MAX || last > INT_MAX || first > last || | 110 | if (first > last || first < stm->data->sw_start || |
111 | first < stm->data->sw_start || | ||
112 | last > stm->data->sw_end) { | 111 | last > stm->data->sw_end) { |
113 | ret = -ERANGE; | 112 | ret = -ERANGE; |
114 | goto unlock; | 113 | goto unlock; |