Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636684 > unrolled thread

[PATCH] i40e: Check for memory allocation failure

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-05-05 21:40 +0200
Last post2017-05-05 21:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] i40e: Check for memory allocation failure Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-05-05 21:40 +0200

#1636684 — [PATCH] i40e: Check for memory allocation failure

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-05-05 21:40 +0200
Subject[PATCH] i40e: Check for memory allocation failure
Message-ID<tDRf4-63i-25@gated-at.bofh.it>
If 'kzalloc' fails, a NULL pointer will be dereferenced. Return -ENOMEM
instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c
index eb2896fd52a6..86e99ed7fb04 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_client.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_client.c
@@ -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++) {
-- 
2.11.0

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web