FreeBSD Bugzilla – Attachment 231293 Details for
Bug 261453
Fix a possible Null pointer dereference in ocs_hw_get_profile_list_cb()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
A simple fix for this bug
0001-Fix-a-possible-Null-pointer-dereference-in-ocs_hw_ge.patch (text/plain), 1.19 KB, created by
Zhou Qingyang
on 2022-01-25 04:08:44 UTC
(
hide
)
Description:
A simple fix for this bug
Filename:
MIME Type:
Creator:
Zhou Qingyang
Created:
2022-01-25 04:08:44 UTC
Size:
1.19 KB
patch
obsolete
>From 2ac1c9c150953ef9257513870dd6d78726f8e1a7 Mon Sep 17 00:00:00 2001 >From: Zhou Qingyang <zhou1615@umn.edu> >Date: Tue, 25 Jan 2022 11:59:44 +0800 >Subject: [PATCH] Fix a possible Null pointer dereference in > ocs_hw_get_profile_list_cb() > >In ocs_hw_get_profile_list_cb(), ocs_malloc() is assigned to list and >has a dereference after that, which could cause null pointer dereference >on failure of allocation. > >Fix this bug by adding a check of list. > >This bug is found by a static analyzer, please advise. > >Signed-off-by: Zhou Qingyang <zhou1615@umn.edu> >--- > sys/dev/ocs_fc/ocs_hw.c | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/sys/dev/ocs_fc/ocs_hw.c b/sys/dev/ocs_fc/ocs_hw.c >index c14b7a97fd9..8fcf31b2151 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; >-- >2.25.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 261453
: 231293