From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752317AbdFVPNF (ORCPT ); Thu, 22 Jun 2017 11:13:05 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:35874 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbdFVPND (ORCPT ); Thu, 22 Jun 2017 11:13:03 -0400 Date: Thu, 22 Jun 2017 11:12:59 -0400 (EDT) Message-Id: <20170622.111259.2189237581775204039.davem@davemloft.net> To: arnd@arndb.de Cc: andrew@lunn.ch, f.fainelli@gmail.com, timur@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: phy: smsc: fix buffer overflow in memcpy From: David Miller In-Reply-To: <20170620204059.790066-1-arnd@arndb.de> References: <20170620204059.790066-1-arnd@arndb.de> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 22 Jun 2017 07:31:18 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann Date: Tue, 20 Jun 2017 22:40:46 +0200 > The memcpy annotation triggers for a fixed-length buffer copy: > > In file included from /git/arm-soc/arch/arm64/include/asm/processor.h:30:0, > from /git/arm-soc/arch/arm64/include/asm/spinlock.h:21, > from /git/arm-soc/include/linux/spinlock.h:87, > from /git/arm-soc/include/linux/seqlock.h:35, > from /git/arm-soc/include/linux/time.h:5, > from /git/arm-soc/include/linux/stat.h:21, > from /git/arm-soc/include/linux/module.h:10, > from /git/arm-soc/drivers/net/phy/smsc.c:20: > In function 'memcpy', > inlined from 'smsc_get_strings' at /git/arm-soc/drivers/net/phy/smsc.c:166:3: > /git/arm-soc/include/linux/string.h:309:4: error: call to '__read_overflow2' declared with attribute error: detected read beyond size of object passed as 2nd parameter > > Using strncpy instead of memcpy should do the right thing here. > > Fixes: 030a89028db0 ("net: phy: smsc: Implement PHY statistics") > Signed-off-by: Arnd Bergmann APplied to net-next, thanks Arnd.