Skip to content

Commit 0a4ecc2

Browse files
tititiou36Jeff Kirsher
authored andcommitted
i40e: Check for memory allocation failure
If 'kzalloc' fails, a NULL pointer will be dereferenced. Return -ENOMEM instead. Signed-off-by: Christophe JAILLET <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent 0bc0706 commit 0a4ecc2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/intel/i40e/i40e_client.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,8 @@ static int i40e_client_setup_qvlist(struct i40e_info *ldev,
595595
size = sizeof(struct i40e_qvlist_info) +
596596
(sizeof(struct i40e_qv_info) * (qvlist_info->num_vectors - 1));
597597
ldev->qvlist_info = kzalloc(size, GFP_KERNEL);
598+
if (!ldev->qvlist_info)
599+
return -ENOMEM;
598600
ldev->qvlist_info->num_vectors = qvlist_info->num_vectors;
599601

600602
for (i = 0; i < qvlist_info->num_vectors; i++) {

0 commit comments

Comments
 (0)