[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z5xrEtiFC4PtSFp6@mev-dev.igk.intel.com>
Date: Fri, 31 Jan 2025 07:17:54 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Jiasheng Jiang <jiashengjiangcool@...il.com>
Cc: anthony.l.nguyen@...el.com, przemyslaw.kitszel@...el.com,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, horms@...nel.org,
wojciech.drewek@...el.com, piotr.raczynski@...el.com,
mateusz.polchlopek@...el.com, pawel.kaminski@...el.com,
michal.wilczynski@...el.com, intel-wired-lan@...ts.osuosl.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ice: Add check for devm_kzalloc()
On Fri, Jan 31, 2025 at 01:38:32AM +0000, Jiasheng Jiang wrote:
> 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 <jiashengjiangcool@...il.com>
> ---
> drivers/net/ethernet/intel/ice/devlink/devlink.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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;
> +
Thanks for fixing:
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
> *priv = node;
>
> return 0;
> --
> 2.25.1
Powered by blists - more mailing lists