diff options
| author | Ram Kishore Vegesna <ram@FreeBSD.org> | 2022-02-09 10:14:12 +0000 |
|---|---|---|
| committer | Ram Kishore Vegesna <ram@FreeBSD.org> | 2022-02-09 10:48:21 +0000 |
| commit | 7bf31432fd03e2a5a815d1cc81de9a7b1ea3d3ca (patch) | |
| tree | 744d08d5b08d3f35ed79c036c5237eec038a8a94 | |
| parent | ca77b6ff31360dae68d5bdb06c7c79229fdf9ce6 (diff) | |
| download | src-7bf31432fd03e2a5a815d1cc81de9a7b1ea3d3ca.tar.gz src-7bf31432fd03e2a5a815d1cc81de9a7b1ea3d3ca.zip | |
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
| -rw-r--r-- | sys/dev/ocs_fc/ocs_hw.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c index c14b7a97fd97..8fcf31b21514 100644 --- a/sys/dev/ocs_fc/ocs_hw.c +++ b/sys/dev/ocs_fc/ocs_hw.c @@ -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; 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; num_descriptors = list->num_descriptors; |
