qcacld-3.0: Correct the logic that checks bound for pmo handler ids

Under unregistering of PMO handlers, incoming component id is sanity
checked. In the logic, WLAN_UMAC_MAX_COMPONENTS as id will not cause
failure even though it is an id beyond the acceptable bound.

Correct the logic so that WLAN_UMAC_MAX_COMPONENTS ends up in failure.

Change-Id: I6935f34c6d91a4217c3f7f73cd5539af2741ed2b
CRs-Fixed: 2091831
This commit is contained in:
Nachiket Kukade
2018-01-04 20:31:01 +05:30
committed by snandini
parent e807596178
commit da14496747

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017 The Linux Foundation. All rights reserved. * Copyright (c) 2018 The Linux Foundation. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -370,7 +370,7 @@ QDF_STATUS pmo_unregister_suspend_handler(
goto out; goto out;
} }
if (id > WLAN_UMAC_MAX_COMPONENTS || id < 0) { if (id >= WLAN_UMAC_MAX_COMPONENTS || id < 0) {
pmo_err("component id: %d is %s then valid components id", pmo_err("component id: %d is %s then valid components id",
id, id < 0 ? "Less" : "More"); id, id < 0 ? "Less" : "More");
status = QDF_STATUS_E_FAILURE; status = QDF_STATUS_E_FAILURE;