qcacmn: Specify the size of array dbgid-strings as WLAN_REF_ID_MAX
Currently, size of the array to return dbgids in string format is not specified explicitly. This array is expected to be updated with the corresponding string when a dbgid is added in the enum wlan_objmgr_ref_dbgid. Any miss in the updation would lead to array out of bound access as the API string_from_dbgid() tries get string corresponds to the newly added dbgid also. Specify the maximum possible size as WLAN_REF_ID_MAX explicitly, so that it returns "null" if the string corresponds a dbgid is not defined. Return the string only if the id matches or return "Unknown". Change-Id: I1c835b8e9d681bf23f1bce866aa523cb41b9a134 CRs-Fixed: 2702696
Cette révision appartient à :

révisé par
nshrivas

Parent
82ce33c6c9
révision
cf645a8923
@@ -360,9 +360,9 @@ typedef enum {
|
||||
* Please note to add new string in the array at index equal to
|
||||
* its enum value in wlan_objmgr_ref_dbgid.
|
||||
*/
|
||||
static inline char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
|
||||
static inline const char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
|
||||
{
|
||||
static const char *strings[] = { "WLAN_OBJMGR_ID",
|
||||
static const char *strings[WLAN_REF_ID_MAX] = { "WLAN_OBJMGR_ID",
|
||||
"WLAN_MLME_SB_ID",
|
||||
"WLAN_MLME_NB_ID",
|
||||
"WLAN_MGMT_SB_ID",
|
||||
@@ -437,10 +437,12 @@ static inline char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
|
||||
"WLAN_PSOC_TARGET_IF_ID",
|
||||
"FTM_TIME_SYNC_ID",
|
||||
"WLAN_PKT_CAPTURE_ID",
|
||||
"WLAN_DCS_ID",
|
||||
"WLAN_REF_ID_MAX"};
|
||||
"WLAN_DCS_ID"};
|
||||
|
||||
return (char *)strings[id];
|
||||
if (id >= WLAN_REF_ID_MAX)
|
||||
return "Unknown";
|
||||
|
||||
return strings[id];
|
||||
}
|
||||
|
||||
#ifdef WLAN_OBJMGR_DEBUG
|
||||
|
Référencer dans un nouveau ticket
Bloquer un utilisateur