ocs_fc: Fix a possible Null pointer dereference

Fix a possible Null pointer dereference in ocs_hw_get_profile_list_cb()

PR: 261453
Reported by: lwhsu

MFC after: 3 days
This commit is contained in:
Ram Kishore Vegesna 2022-02-09 15:44:12 +05:30
parent ca77b6ff31
commit 7bf31432fd

View File

@ -7581,6 +7581,11 @@ ocs_hw_get_profile_list_cb(ocs_hw_t *hw, int32_t status, uint8_t *mqe, void *arg
int num_descriptors; int num_descriptors;
list = ocs_malloc(hw->os, sizeof(ocs_hw_profile_list_t), OCS_M_ZERO); list = ocs_malloc(hw->os, sizeof(ocs_hw_profile_list_t), OCS_M_ZERO);
if (list == NULL) {
ocs_log_err(hw->os, "failed to malloc list\n");
return OCS_HW_RTN_NO_MEMORY;
}
list->num_descriptors = response->profile_descriptor_count; list->num_descriptors = response->profile_descriptor_count;
num_descriptors = list->num_descriptors; num_descriptors = list->num_descriptors;