Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752623AbdHRQkJ (ORCPT ); Fri, 18 Aug 2017 12:40:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45258 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbdHRQkH (ORCPT ); Fri, 18 Aug 2017 12:40:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5D2892027C Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dledford@redhat.com Message-ID: <1503074405.2598.25.camel@redhat.com> Subject: Re: [PATCH] infiniband: avoid overflow warning From: Doug Ledford 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@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 18 Aug 2017 12:40:05 -0400 In-Reply-To: <20170731065016.2947796-1-arnd@arndb.de> References: <20170731065016.2947796-1-arnd@arndb.de> Organization: Red Hat, Inc. Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 18 Aug 2017 16:40:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1306 Lines: 34 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