From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
Daria Velikovsky <daria@mellanox.com>,
<linux-rdma@vger.kernel.org>, Maor Gottlieb <maorg@mellanox.com>
Subject: Re: [PATCH rdma-next] RDMA/mlx5: Init dest_type when create flow
Date: Mon, 13 Jul 2020 08:53:13 -0300 [thread overview]
Message-ID: <20200713115313.GA2021234@nvidia.com> (raw)
In-Reply-To: <20200712174016.GC7287@unreal>
On Sun, Jul 12, 2020 at 08:40:16PM +0300, Leon Romanovsky wrote:
> On Fri, Jul 10, 2020 at 04:46:44PM -0300, Jason Gunthorpe wrote:
> > On Tue, Jul 07, 2020 at 02:02:59PM +0300, Leon Romanovsky wrote:
> > > From: Daria Velikovsky <daria@mellanox.com>
> > >
> > > When using action drop dest_type was never assigned to any value.
> > > Add initialization of dest_type to -1 since 0 is valid.
> > >
> > > Fixes: f29de9eee782 ("RDMA/mlx5: Add support for drop action in DV steering")
> > > Signed-off-by: Daria Velikovsky <daria@mellanox.com>
> > > Reviewed-by: Maor Gottlieb <maorg@mellanox.com>
> > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > > Based on
> > > https://lore.kernel.org/lkml/20200702081809.423482-1-leon@kernel.org
> > > drivers/infiniband/hw/mlx5/fs.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/fs.c
> > > index 0d8abb7c3cdf..1a7e6226f11a 100644
> > > +++ b/drivers/infiniband/hw/mlx5/fs.c
> > > @@ -1903,7 +1903,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)(
> > > struct mlx5_flow_context flow_context = {.flow_tag =
> > > MLX5_FS_DEFAULT_FLOW_TAG};
> > > u32 *offset_attr, offset = 0, counter_id = 0;
> > > - int dest_id, dest_type, inlen, len, ret, i;
> > > + int dest_id, dest_type = -1, inlen, len, ret, i;
> >
> > I think this should be done inside get_dests() - it is pretty ugly to
> > have an function with an output pointer that is only filled sometimes
> > on success.
>
> This was original patch which I rewrote because don't like the approach
> when function changes fields when it doesn't need to change. I prefer
> the current approach where caller has explicitly decided which default
> value he wants.
How is it a "default value" ? The function's job is to fill dest_type,
it should fill it correctly or fail
Jason
next prev parent reply other threads:[~2020-07-13 11:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 11:02 [PATCH rdma-next] RDMA/mlx5: Init dest_type when create flow Leon Romanovsky
2020-07-10 19:46 ` Jason Gunthorpe
2020-07-12 17:40 ` Leon Romanovsky
2020-07-13 11:53 ` Jason Gunthorpe [this message]
2020-07-14 6:10 ` Leon Romanovsky
2020-07-16 17:12 ` Jason Gunthorpe
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=20200713115313.GA2021234@nvidia.com \
--to=jgg@nvidia.com \
--cc=daria@mellanox.com \
--cc=dledford@redhat.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=maorg@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).