linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Mike Marciniszyn <mike.marciniszyn@intel.com>,
	Ralph Campbell <ralph.campbell@qlogic.com>
Subject: Re: [PATCH rdma-next 07/16] RDMA/hfi1: Delete unreachable code
Date: Tue, 29 Oct 2019 16:33:27 -0700	[thread overview]
Message-ID: <20191029233327.GA18853@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <20191029062745.7932-8-leon@kernel.org>

On Tue, Oct 29, 2019 at 08:27:36AM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> All callers allocate MAD structures with proper sizes,
> there is no need to recheck it.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/hfi1/mad.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/mad.c b/drivers/infiniband/hw/hfi1/mad.c
> index d8ff063a5419..a54746f4a0ae 100644
> --- a/drivers/infiniband/hw/hfi1/mad.c
> +++ b/drivers/infiniband/hw/hfi1/mad.c
> @@ -4921,10 +4921,6 @@ int hfi1_process_mad(struct ib_device *ibdev, int mad_flags, u8 port,
>  {
>  	switch (in_mad->base_version) {
>  	case OPA_MGMT_BASE_VERSION:
> -		if (unlikely(in_mad_size != sizeof(struct opa_mad))) {
> -			dev_err(ibdev->dev.parent, "invalid in_mad_size\n");
> -			return IB_MAD_RESULT_FAILURE;
> -		}

It's been a while but I'm not 100% sure we can safely remove this check.  A
user can send an IB sized MAD to an OPA device and AFAIR there is nothing
checking that the base version is set correctly for the size of mad received by
the mad stack.

Are you 100% sure that the in_mad_size is based off the management base
version?

Also, regarding the patches to remove the checks on the IB devices I would want
to see that check in the core MAD stack to verify we are not sending an OPA mad
to an IB device.  I may have put a check in there already so removing the code
in those drivers may be ok.  I'm not sure off the top of my head...

Ira

>  		return hfi1_process_opa_mad(ibdev, mad_flags, port,
>  					    in_wc, in_grh,
>  					    (struct opa_mad *)in_mad,
> -- 
> 2.20.1
> 

  reply	other threads:[~2019-10-29 23:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-29  6:27 [PATCH rdma-next 00/16] MAD cleanup Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 01/16] RDMA/mad: Delete never implemented functions Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 02/16] RDMA/mad: Allocate zeroed MAD buffer Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 03/16] RDMA/mlx4: Delete redundant zero memset Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 04/16] RDMA/mlx5: " Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 05/16] RDMA/ocrdma: Clean MAD processing logic Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 06/16] RDMA/qib: Delete redundant memset for MAD output buffer Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 07/16] RDMA/hfi1: Delete unreachable code Leon Romanovsky
2019-10-29 23:33   ` Ira Weiny [this message]
2019-10-30  0:02     ` Ira Weiny
2019-10-29  6:27 ` [PATCH rdma-next 08/16] RDMA/mlx4: " Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 09/16] RDMA/mlx5: " Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 10/16] RDMA/mthca: " Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 11/16] RDMA/ocrdma: Simplify process_mad function Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 12/16] RDMA/qib: Delete unreachable code Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 13/16] RDMA/mlx5: Rewrite MAD processing logic to be readable Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 14/16] RDMA/qib: Delete extra line Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 15/16] RDMA/qib: Delete unused variable in process_cc call Leon Romanovsky
2019-10-29  6:27 ` [PATCH rdma-next 16/16] RDMA: Change MAD processing function to remove extra casting and parameter Leon Romanovsky
2019-11-11 13:33   ` Marciniszyn, Mike
2019-11-11 15:06     ` Leon Romanovsky
2019-11-06 20:14 ` [PATCH rdma-next 00/16] MAD cleanup Jason Gunthorpe
2019-11-11 15:06   ` Leon Romanovsky
2019-11-13  0:37 ` 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=20191029233327.GA18853@iweiny-DESK2.sc.intel.com \
    --to=ira.weiny@intel.com \
    --cc=dledford@redhat.com \
    --cc=jgg@mellanox.com \
    --cc=leon@kernel.org \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mike.marciniszyn@intel.com \
    --cc=ralph.campbell@qlogic.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).