From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jiri Pirko <jiri@mellanox.com>, Yotam Gigi <yotamg@mellanox.com>
Cc: Ido Schimmel <idosch@mellanox.com>,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2 net-next] mlxsw: spectrum: Add missing error code on allocation failure
Date: Tue, 3 Oct 2017 13:53:41 +0300 [thread overview]
Message-ID: <20171003105340.llwk5oajgrohbksu@mwanda> (raw)
In-Reply-To: <20171003105303.u7yrzxknddmmerol@mwanda>
We accidentally return success if the kmalloc_array() call fails.
Fixes: 0e14c7777acb ("mlxsw: spectrum: Add the multicast routing hardware logic")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
index 5e4ccbf17e3d..839eadf0765b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr_tcam.c
@@ -763,8 +763,10 @@ mlxsw_sp_mr_tcam_region_init(struct mlxsw_sp *mlxsw_sp,
parman_prios = kmalloc_array(MLXSW_SP_MR_ROUTE_PRIO_MAX + 1,
sizeof(*parman_prios), GFP_KERNEL);
- if (!parman_prios)
+ if (!parman_prios) {
+ err = -ENOMEM;
goto err_parman_prios_alloc;
+ }
mr_tcam_region->parman_prios = parman_prios;
for (i = 0; i < MLXSW_SP_MR_ROUTE_PRIO_MAX + 1; i++)
next prev parent reply other threads:[~2017-10-03 10:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 10:53 [PATCH 1/2 net-next] mlxsw: spectrum: Fix check for IS_ERR() instead of NULL Dan Carpenter
2017-10-03 10:53 ` Dan Carpenter [this message]
2017-10-03 10:56 ` [PATCH 2/2 net-next] mlxsw: spectrum: Add missing error code on allocation failure Yotam Gigi
2017-10-03 17:27 ` David Miller
2017-10-03 10:58 ` [PATCH 1/2 net-next] mlxsw: spectrum: Fix check for IS_ERR() instead of NULL Yotam Gigi
2017-10-03 17:27 ` David Miller
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=20171003105340.llwk5oajgrohbksu@mwanda \
--to=dan.carpenter@oracle.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yotamg@mellanox.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).