aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/devlink
diff options
context:
space:
mode:
authorJiasheng Jiang <[email protected]>2025-01-31 01:38:32 +0000
committerJakub Kicinski <[email protected]>2025-02-02 00:57:50 +0000
commita8aa6a6ddce9b5585f2b74f27f3feea1427fb4e7 (patch)
treef24b73273779495a198e1661f1d474457b7d449d /drivers/net/ethernet/intel/ice/devlink
parentnet: ipv6: fix dst ref loops in rpl, seg6 and ioam6 lwtunnels (diff)
downloadkernel-a8aa6a6ddce9b5585f2b74f27f3feea1427fb4e7.tar.gz
kernel-a8aa6a6ddce9b5585f2b74f27f3feea1427fb4e7.zip
ice: Add check for devm_kzalloc()
Add check for the return value of devm_kzalloc() to guarantee the success of allocation. Fixes: 42c2eb6b1f43 ("ice: Implement devlink-rate API") Signed-off-by: Jiasheng Jiang <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/devlink')
-rw-r--r--drivers/net/ethernet/intel/ice/devlink/devlink.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index d116e2b10bce..dbdb83567364 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -981,6 +981,9 @@ static int ice_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv
/* preallocate memory for ice_sched_node */
node = devm_kzalloc(ice_hw_to_dev(pi->hw), sizeof(*node), GFP_KERNEL);
+ if (!node)
+ return -ENOMEM;
+
*priv = node;
return 0;