From da144967472bd4d11e7a6de97800fd581aa33c1a Mon Sep 17 00:00:00 2001 From: Nachiket Kukade Date: Thu, 4 Jan 2018 20:31:01 +0530 Subject: [PATCH] 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 --- components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c b/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c index 0934943fef..6ba272318c 100644 --- a/components/pmo/dispatcher/src/wlan_pmo_obj_mgmt_api.c +++ b/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;