diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2017-01-17 17:18:20 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-01-17 17:18:19 -0800 |
commit | bc2951693197891f708a4c2e0a1ad1835193e79f (patch) | |
tree | 492e90aefb2e974fea9a199e9741466081c22bf9 /drivers | |
parent | fb1df1530f512615b646a34e4a26f89609e7833e (diff) | |
parent | f0ea5d918d4916715bd041175b92004224753e6d (diff) |
Merge "qcom-charger: msm_bcl: fix out of bounds array access"
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/qcom-charger/msm_bcl.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/power/qcom-charger/msm_bcl.c b/drivers/power/qcom-charger/msm_bcl.c index 6b7cefdc0250..aea3f4645897 100644 --- a/drivers/power/qcom-charger/msm_bcl.c +++ b/drivers/power/qcom-charger/msm_bcl.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -99,14 +99,14 @@ int msm_bcl_set_threshold(enum bcl_param param_type, { int ret = 0; - if (!bcl[param_type] || !bcl[param_type]->registered) { + if (param_type >= BCL_PARAM_MAX || !bcl[param_type] + || !bcl[param_type]->registered) { pr_err("BCL not initialized\n"); return -EINVAL; } if ((!inp_thresh) || (inp_thresh->trip_value < 0) || (!inp_thresh->trip_notify) - || (param_type >= BCL_PARAM_MAX) || (trip_type >= BCL_TRIP_MAX)) { pr_err("Invalid Input\n"); return -EINVAL; @@ -152,8 +152,8 @@ struct bcl_param_data *msm_bcl_register_param(enum bcl_param param_type, { int ret = 0; - if (!bcl[param_type] - || param_type >= BCL_PARAM_MAX || !param_ops || !name + if (param_type >= BCL_PARAM_MAX + || !bcl[param_type] || !param_ops || !name || !param_ops->read || !param_ops->set_high_trip || !param_ops->get_high_trip || !param_ops->set_low_trip || !param_ops->get_low_trip || !param_ops->enable |