Skip to content

wdc: fix null pointer dereference in get_dev_mgmt_log_page_lid_data()#3579

Open
LJaved-IBM wants to merge 1 commit into
linux-nvme:masterfrom
LJaved-IBM:fix-null-ptr-get-dev-mgmt-log
Open

wdc: fix null pointer dereference in get_dev_mgmt_log_page_lid_data()#3579
LJaved-IBM wants to merge 1 commit into
linux-nvme:masterfrom
LJaved-IBM:fix-null-ptr-get-dev-mgmt-log

Conversation

@LJaved-IBM

Copy link
Copy Markdown

The get_dev_mgmt_log_page_lid_data() function initializes @sph to
a pointer derived from @DaTa before passing it to
wdc_get_dev_mng_log_entry(). However, that function immediately
sets *p_p_found_log_entry to NULL, making the initial value of
@sph irrelevant and leaving a potentially misleading non-NULL
value before the call.

The Clang static analyzer flags this as a null pointer dereference
since @sph may be NULL when dereferenced after the function call.

Initialize @sph to NULL before the call to make the intent clear
and remove the now-redundant null check in wdc_get_dev_mng_log_entry().

Signed-off-by: Laraib Javed laraibjaved@ibm.com

The get_dev_mgmt_log_page_lid_data() function initializes @sph to
a pointer derived from @DaTa before passing it to
wdc_get_dev_mng_log_entry(). However, that function immediately
sets *p_p_found_log_entry to NULL, making the initial value of
@sph irrelevant and leaving a potentially misleading non-NULL
value before the call.

The Clang static analyzer flags this as a null pointer dereference
since @sph may be NULL when dereferenced after the function call.

Initialize @sph to NULL before the call to make the intent clear
and suppress the false dereference warning.

Signed-off-by: Laraib Javed <laraibjaved@ibm.com>
@igaw

igaw commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Could you rebase this change, there is merge conflict. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants