qcacld-3.0: Fix off-by-one errors in PMO

The following PMO functions have been identified as having off-by-one
logic errors. Address these errors.

 * pmo_register_resume_handler
 * pmo_register_suspend_handler
 * pmo_unregister_resume_handler
 * pmo_suspend_all_components

Change-Id: I6a328fc24ae6a575ef56cf9532133eb666e0dc8c
CRs-Fixed: 2232388
This commit is contained in:
Dustin Brown
2018-05-02 09:53:12 -07:00
committed by nshrivas
parent 9a7f678c54
commit dd2178d146

View File

@@ -337,7 +337,7 @@ QDF_STATUS pmo_register_suspend_handler(
goto out;
}
if (id > WLAN_UMAC_MAX_COMPONENTS || id < 0) {
if (id < 0 || id >= WLAN_UMAC_MAX_COMPONENTS) {
pmo_err("component id: %d is %s then valid components id",
id, id < 0 ? "Less" : "More");
status = QDF_STATUS_E_FAILURE;
@@ -370,7 +370,7 @@ QDF_STATUS pmo_unregister_suspend_handler(
goto out;
}
if (id >= WLAN_UMAC_MAX_COMPONENTS || id < 0) {
if (id < 0 || id >= WLAN_UMAC_MAX_COMPONENTS) {
pmo_err("component id: %d is %s then valid components id",
id, id < 0 ? "Less" : "More");
status = QDF_STATUS_E_FAILURE;
@@ -409,7 +409,7 @@ QDF_STATUS pmo_register_resume_handler(
goto out;
}
if (id > WLAN_UMAC_MAX_COMPONENTS || id < 0) {
if (id < 0 || id >= WLAN_UMAC_MAX_COMPONENTS) {
pmo_err("component id: %d is %s then valid components id",
id, id < 0 ? "Less" : "More");
status = QDF_STATUS_E_FAILURE;
@@ -441,7 +441,7 @@ QDF_STATUS pmo_unregister_resume_handler(
goto out;
}
if (id > WLAN_UMAC_MAX_COMPONENTS || id < 0) {
if (id < 0 || id >= WLAN_UMAC_MAX_COMPONENTS) {
pmo_err("component id: %d is %s then valid components id",
id, id < 0 ? "Less" : "More");
status = QDF_STATUS_E_FAILURE;
@@ -470,7 +470,7 @@ QDF_STATUS pmo_suspend_all_components(struct wlan_objmgr_psoc *psoc,
QDF_STATUS status = QDF_STATUS_SUCCESS;
QDF_STATUS resume_status;
struct wlan_pmo_ctx *pmo_ctx;
uint8_t i;
int i;
pmo_psoc_suspend_handler handler;
void *arg;
@@ -521,7 +521,7 @@ suspend_recovery:
pmo_fatal("Non-recoverable failure occurred!");
pmo_fatal("component %d failed to resume; status: %d",
i, resume_status);
QDF_BUG(0);
QDF_DEBUG_PANIC();
}
}