Skip to content

nbft: fix sizeof operand mismatch in pointer array allocations#3469

Open
bellis-ibm wants to merge 1 commit into
linux-nvme:masterfrom
bellis-ibm:libnvme-nbft-sizeof-fix
Open

nbft: fix sizeof operand mismatch in pointer array allocations#3469
bellis-ibm wants to merge 1 commit into
linux-nvme:masterfrom
bellis-ibm:libnvme-nbft-sizeof-fix

Conversation

@bellis-ibm

@bellis-ibm bellis-ibm commented Jun 22, 2026

Copy link
Copy Markdown

Four calloc() calls used sizeof(struct) instead of sizeof(struct *)
when allocating pointer arrays. The hfi_list, security_list,
discovery_list, and subsystem_ns_list objects are declared as
pointer arrays and should be allocated using the pointer type size.

Use sizeof(struct *) to match the array element type and resolve the
static analysis warnings.

Signed-off-by: Brooke Ellis Brooke.Ellis@ibm.com

The hfi_list, security_list, discovery_list, and subsystem_ns_list

arrays were allocated using sizeof(struct) instead of sizeof(struct *),

which caused memory over-allocation and triggered static analysis

warnings. These arrays store pointers to structs, not the structs

themselves. Changed to use sizeof(struct *) to allocate the correct

amount of memory for pointer arrays.

Signed-off-by:Brooke Ellis <Brooke.Ellis@ibm.com>
@bellis-ibm bellis-ibm marked this pull request as ready for review June 22, 2026 21:29
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.

1 participant