Re: [PATCH] infiniband: avoid overflow warning

2017-08-18 Thread Doug Ledford
On Mon, 2017-07-31 at 08:50 +0200, Arnd Bergmann wrote: > A sockaddr_in structure on the stack getting passed into rdma_ip2gid > triggers this warning, since we memcpy into a larger sockaddr_in6 > structure: > > In function 'memcpy', > inlined from 'rdma_ip2gid' at include/rdma/ib_addr.h:175:3

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Kees Cook
On Mon, Jul 31, 2017 at 2:52 PM, Arnd Bergmann wrote: > On Mon, Jul 31, 2017 at 11:18 PM, Kees Cook wrote: >> On Mon, Jul 31, 2017 at 2:10 PM, Arnd Bergmann wrote: >>> On Mon, Jul 31, 2017 at 10:58 PM, Kees Cook wrote: On Mon, Jul 31, 2017 at 12:30 AM, Arnd Bergmann wrote: > On Mon, J

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Arnd Bergmann
On Mon, Jul 31, 2017 at 11:18 PM, Kees Cook wrote: > On Mon, Jul 31, 2017 at 2:10 PM, Arnd Bergmann wrote: >> On Mon, Jul 31, 2017 at 10:58 PM, Kees Cook wrote: >>> On Mon, Jul 31, 2017 at 12:30 AM, Arnd Bergmann wrote: On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: >>

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Daniel Micay
On Mon, 2017-07-31 at 14:18 -0700, Kees Cook wrote: > On Mon, Jul 31, 2017 at 2:10 PM, Arnd Bergmann wrote: > > On Mon, Jul 31, 2017 at 10:58 PM, Kees Cook > > wrote: > > > On Mon, Jul 31, 2017 at 12:30 AM, Arnd Bergmann > > > wrote: > > > > On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua > > > > w

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Kees Cook
On Mon, Jul 31, 2017 at 2:10 PM, Arnd Bergmann wrote: > On Mon, Jul 31, 2017 at 10:58 PM, Kees Cook wrote: >> On Mon, Jul 31, 2017 at 12:30 AM, Arnd Bergmann wrote: >>> On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: > break; > default: > r

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Arnd Bergmann
On Mon, Jul 31, 2017 at 10:58 PM, Kees Cook wrote: > On Mon, Jul 31, 2017 at 12:30 AM, Arnd Bergmann wrote: >> On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: break; default: return -EINVAL; >>> what happens if you replace 16 with sizeof(

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Kees Cook
On Mon, Jul 31, 2017 at 12:30 AM, Arnd Bergmann wrote: > On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: >> On Mon, Jul 31, 2017 at 9:50 AM, Arnd Bergmann wrote: >>> --- a/include/rdma/ib_addr.h >>> +++ b/include/rdma/ib_addr.h >>> @@ -172,7 +172,8 @@ static inline int rdma_ip2gid(struct sock

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Daniel Micay
On Mon, 2017-07-31 at 21:19 +0200, Arnd Bergmann wrote: > On Mon, Jul 31, 2017 at 6:17 PM, Bart Van Assche om> wrote: > > On Mon, 2017-07-31 at 18:04 +0200, Arnd Bergmann wrote: > > > On Mon, Jul 31, 2017 at 5:32 PM, Bart Van Assche > > dc.com> wrote: > > > > So inetaddr_event() assigns AF_INET s

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Arnd Bergmann
On Mon, Jul 31, 2017 at 6:17 PM, Bart Van Assche wrote: > On Mon, 2017-07-31 at 18:04 +0200, Arnd Bergmann wrote: >> On Mon, Jul 31, 2017 at 5:32 PM, Bart Van Assche >> wrote: >> > So inetaddr_event() assigns AF_INET so .sin_family and gcc warns about code >> > that is only executed if .sin_fami

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Bart Van Assche
On Mon, 2017-07-31 at 18:04 +0200, Arnd Bergmann wrote: > On Mon, Jul 31, 2017 at 5:32 PM, Bart Van Assche > wrote: > > So inetaddr_event() assigns AF_INET so .sin_family and gcc warns about code > > that is only executed if .sin_family == AF_INET6? Since this warning is the > > result of incorre

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Arnd Bergmann
On Mon, Jul 31, 2017 at 5:32 PM, Bart Van Assche wrote: > On Mon, 2017-07-31 at 09:30 +0200, Arnd Bergmann wrote: >> On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: >> > On Mon, Jul 31, 2017 at 9:50 AM, Arnd Bergmann wrote: >> > > --- a/include/rdma/ib_addr.h >> > > +++ b/include/rdma/ib_addr

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Bart Van Assche
On Mon, 2017-07-31 at 09:30 +0200, Arnd Bergmann wrote: > On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: > > On Mon, Jul 31, 2017 at 9:50 AM, Arnd Bergmann wrote: > > > --- a/include/rdma/ib_addr.h > > > +++ b/include/rdma/ib_addr.h > > > @@ -172,7 +172,8 @@ static inline int rdma_ip2gid(stru

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Arnd Bergmann
On Mon, Jul 31, 2017 at 9:08 AM, Moni Shoua wrote: > On Mon, Jul 31, 2017 at 9:50 AM, Arnd Bergmann wrote: >> --- a/include/rdma/ib_addr.h >> +++ b/include/rdma/ib_addr.h >> @@ -172,7 +172,8 @@ static inline int rdma_ip2gid(struct sockaddr *addr, >> union ib_gid *gid) >>

Re: [PATCH] infiniband: avoid overflow warning

2017-07-31 Thread Moni Shoua
On Mon, Jul 31, 2017 at 9:50 AM, Arnd Bergmann wrote: > A sockaddr_in structure on the stack getting passed into rdma_ip2gid > triggers this warning, since we memcpy into a larger sockaddr_in6 > structure: > > In function 'memcpy', > inlined from 'rdma_ip2gid' at include/rdma/ib_addr.h:175:3,

[PATCH] infiniband: avoid overflow warning

2017-07-30 Thread Arnd Bergmann
A sockaddr_in structure on the stack getting passed into rdma_ip2gid triggers this warning, since we memcpy into a larger sockaddr_in6 structure: In function 'memcpy', inlined from 'rdma_ip2gid' at include/rdma/ib_addr.h:175:3, inlined from 'addr_event.isra.4.constprop' at drivers/infinib