Jelajahi Sumber

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
Nachiket Kukade 7 tahun lalu
induk
melakukan
da14496747
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c

+ 2 - 2
components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c

@@ -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
  * any purpose with or without fee is hereby granted, provided that the
@@ -370,7 +370,7 @@ QDF_STATUS pmo_unregister_suspend_handler(
 		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",
 			id, id < 0 ? "Less" : "More");
 		status = QDF_STATUS_E_FAILURE;