From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Ledford Subject: Re: [PATCH] infiniband: avoid overflow warning Date: Fri, 18 Aug 2017 12:40:05 -0400 Message-ID: <1503074405.2598.25.camel@redhat.com> References: <20170731065016.2947796-1-arnd@arndb.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170731065016.2947796-1-arnd-r2nGTMty4D4@public.gmane.org> Sender: linux-rdma-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Arnd Bergmann , Sean Hefty , Hal Rosenstock Cc: Daniel Micay , Kees Cook , Moni Shoua , "Kalderon, Michal" , Ariel Elior , "David S. Miller" , Bart Van Assche , Parav Pandit , Noa Osherovich , linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-rdma@vger.kernel.org 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, > inlined from 'addr_event.isra.4.constprop' at > drivers/infiniband/core/roce_gid_mgmt.c:693:2, > inlined from 'inetaddr_event' at > drivers/infiniband/core/roce_gid_mgmt.c:716:9: > include/linux/string.h:305:4: error: call to '__read_overflow2' > declared with attribute error: detected read beyond size of object > passed as 2nd parameter > > The warning seems appropriate here, but the code is also clearly > correct, so we really just want to shut up this instance of the > output. > > The best way I found so far is to avoid the memcpy() call and instead > replace it with a struct assignment. > > Fixes: 6974f0c4555e ("include/linux/string.h: add the option of > fortified string.h functions") > Cc: Daniel Micay > Cc: Kees Cook > Signed-off-by: Arnd Bergmann Thanks, applied. -- Doug Ledford GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html