From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
To: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Cc: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
wojciech.drewek@intel.com, piotr.raczynski@intel.com,
mateusz.polchlopek@intel.com, pawel.kaminski@intel.com,
michal.wilczynski@intel.com, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ice: Add check for devm_kzalloc()
Date: Fri, 31 Jan 2025 07:17:54 +0100 [thread overview]
Message-ID: <Z5xrEtiFC4PtSFp6@mev-dev.igk.intel.com> (raw)
In-Reply-To: <20250131013832.24805-1-jiashengjiangcool@gmail.com>
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@gmail.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@linux.intel.com>
> *priv = node;
>
> return 0;
> --
> 2.25.1
next prev parent reply other threads:[~2025-01-31 6:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-31 1:38 [PATCH] ice: Add check for devm_kzalloc() Jiasheng Jiang
2025-01-31 6:17 ` Michal Swiatkowski [this message]
2025-02-02 1:20 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z5xrEtiFC4PtSFp6@mev-dev.igk.intel.com \
--to=michal.swiatkowski@linux.intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jiashengjiangcool@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mateusz.polchlopek@intel.com \
--cc=michal.wilczynski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pawel.kaminski@intel.com \
--cc=piotr.raczynski@intel.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=wojciech.drewek@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).