[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190517113230.6sx5amsm3vsji2mz@verge.net.au>
Date: Fri, 17 May 2019 13:32:30 +0200
From: Simon Horman <horms@...ge.net.au>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
David Miller <davem@...emloft.net>,
Doug Ledford <dledford@...hat.com>,
linux-rdma <linux-rdma@...r.kernel.org>,
Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2] RDMA: Directly cast the sockaddr union to sockaddr
On Thu, May 16, 2019 at 12:21:48PM -0300, Jason Gunthorpe wrote:
> On Thu, May 16, 2019 at 02:44:28PM +0200, Simon Horman wrote:
> > 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@...lanox.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>
>
> Well, I was thinking of swapping the union to sockaddr_storage ..
>
> Do you propose to add a union to the kernel's sockaddr storage?
I understand you have been down that rabbit hole before but,
yes, in an ideal world that would be my preference.
Powered by blists - more mailing lists