linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	David Miller <davem@davemloft.net>,
	Doug Ledford <dledford@redhat.com>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	Linux List Kernel Mailing <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] RDMA: Directly cast the sockaddr union to sockaddr
Date: Thu, 16 May 2019 14:44:28 +0200	[thread overview]
Message-ID: <20190516124428.hytvkwfltfi24lrv@verge.net.au> (raw)
In-Reply-To: <20190514005521.GA18085@ziepe.ca>

On Mon, May 13, 2019 at 09:55:21PM -0300, Jason Gunthorpe wrote:
> gcc 9 now does allocation size tracking and thinks that passing the member
> of a union and then accessing beyond that member's bounds is an overflow.
> 
> Instead of using the union member, use the entire union with a cast to
> get to the sockaddr. gcc will now know that the memory extends the full
> size of the union.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>  drivers/infiniband/core/addr.c           | 16 ++++++++--------
>  drivers/infiniband/hw/ocrdma/ocrdma_ah.c |  5 ++---
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c |  5 ++---
>  3 files changed, 12 insertions(+), 14 deletions(-)
> 
> I missed the ocrdma files in the v1
> 
> We can revisit what to do with that repetitive union after the merge
> window, but this simple patch will eliminate the warnings for now.
> 
> Linus, I'll send this as a PR tomorrow - there is also a bug fix for
> the rdma-netlink changes posted that should go too.

<2c>
I would be very happy to see this revisited in such a way
that some use is made of the C type system (instead of casts).
</2c>

  reply	other threads:[~2019-05-16 12:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14  0:55 [PATCH v2] RDMA: Directly cast the sockaddr union to sockaddr Jason Gunthorpe
2019-05-16 12:44 ` Simon Horman [this message]
2019-05-16 15:21   ` Jason Gunthorpe
2019-05-17 11:32     ` Simon Horman

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=20190516124428.hytvkwfltfi24lrv@verge.net.au \
    --to=horms@verge.net.au \
    --cc=davem@davemloft.net \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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).