aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorAkeem G Abodunrin <akeem.g.abodunrin@intel.com>2014-02-06 00:51:02 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-03-06 21:41:22 -0500
commitcc6456af2c05eb02ec1efcddde688ac99da76e57 (patch)
treeefd88c9def4ed27cbd7515a69bca3a090b7043a2 /drivers/net/ethernet
parent17a73f6b14010d4516a05f52e3c87431e86edebb (diff)
i40e: Prevent overflow due to kzalloc
To prevent the possibility of overflow due multiplication of number and size use kcalloc instead of kzalloc. Change-ID: Ibe4d81ed7d9738d3bbe66ee4844ff9be817e8080 Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com> Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com> Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 189e250198dd..42cc6ba88005 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -858,7 +858,7 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
858 } 858 }
859 } 859 }
860 /* allocate memory */ 860 /* allocate memory */
861 vfs = kzalloc(num_alloc_vfs * sizeof(struct i40e_vf), GFP_KERNEL); 861 vfs = kcalloc(num_alloc_vfs, sizeof(struct i40e_vf), GFP_KERNEL);
862 if (!vfs) { 862 if (!vfs) {
863 ret = -ENOMEM; 863 ret = -ENOMEM;
864 goto err_alloc; 864 goto err_alloc;