Skip to content

Commit

Permalink
i40e: Check for memory allocation failure
Browse files Browse the repository at this point in the history
If 'kzalloc' fails, a NULL pointer will be dereferenced. Return -ENOMEM
instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Christophe Jaillet authored and Jeff Kirsher committed May 31, 2017
1 parent 0bc0706 commit 0a4ecc2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/intel/i40e/i40e_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ static int i40e_client_setup_qvlist(struct i40e_info *ldev,
size = sizeof(struct i40e_qvlist_info) +
(sizeof(struct i40e_qv_info) * (qvlist_info->num_vectors - 1));
ldev->qvlist_info = kzalloc(size, GFP_KERNEL);
if (!ldev->qvlist_info)
return -ENOMEM;
ldev->qvlist_info->num_vectors = qvlist_info->num_vectors;

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

0 comments on commit 0a4ecc2

Please sign in to comment.