From: Leon Romanovsky <leonro@mellanox.com>
To: Colin King <colin.king@canonical.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
Matan Barak <matanb@mellanox.com>,
netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mlx5: ensure 0 is returned when vport is zero
Date: Fri, 18 Aug 2017 19:02:02 +0300 [thread overview]
Message-ID: <20170818160202.GA18138@mtr-leonro.local> (raw)
In-Reply-To: <20170818134925.16604-1-colin.king@canonical.com>
[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]
On Fri, Aug 18, 2017 at 02:49:25PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently, if vport is zero then then an uninialized return status
> in err is returned. Since the only return status at the end of the
> function esw_add_uc_addr is zero for the current set of return paths
> we may as well just return 0 rather than err to fix this issue.
>
> Detected by CoverityScan, CID#1452698 ("Uninitialized scalar variable")
>
> Fixes: eeb66cdb6826 ("net/mlx5: Separate between E-Switch and MPFS")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> index 6d9fb6ac6e9b..c77f4c0c7769 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
> @@ -401,7 +401,7 @@ static int esw_add_uc_addr(struct mlx5_eswitch *esw, struct vport_addr *vaddr)
> esw_debug(esw->dev, "\tADDED UC MAC: vport[%d] %pM fr(%p)\n",
> vport, mac, vaddr->flow_rule);
>
> - return err;
> + return 0;
> }
>
I personally prefer initialization of "err" to zero, but this solution
is fine enough too.
Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-08-18 16:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 13:49 [PATCH] mlx5: ensure 0 is returned when vport is zero Colin King
2017-08-18 16:02 ` Leon Romanovsky [this message]
[not found] ` <20170818134925.16604-1-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2017-08-18 23:29 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-08-18 15:25 Colin King
[not found] ` <20170818152550.18358-1-colin.king-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2017-08-18 15:27 ` Colin Ian King
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=20170818160202.GA18138@mtr-leonro.local \
--to=leonro@mellanox.com \
--cc=colin.king@canonical.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=matanb@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@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