Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4159786ybi; Mon, 27 May 2019 12:20:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxDJYRqJJEB+PdAQdNXJmVFsbpL+/ddXq9fnwB05ungl26WvdJ+JFdTcKn5omis1NsLGeNB X-Received: by 2002:a62:cdc6:: with SMTP id o189mr110944840pfg.74.1558984854894; Mon, 27 May 2019 12:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558984854; cv=none; d=google.com; s=arc-20160816; b=J0HzvBXmQkcsNXvA+IZApAfPq2I1dLdgmVf/DoqWQhDdk9r6P8SRa3Py/jjPfwMqwU wthM8jk1f198/6zEuLNx9+6ONOaU3M2L0xIrOdLFM6ezmSjInsr9l2zfk6Q97RsM9uYD 6uNoBmZxfyiIY5rOq4ndgm2sbRhGqasP/2wya0ocahiE/4821Cacol6zyoIDHJq5pmVX uzJSr++B1S7p7l2GuB2GqvwwBIsW/8/eGB7iP3w41EiKaxzE94zS7ZTttBBmFQMI8pLG GehRDuDaBEmC1kVvnm3s7SIWFXdxhXMoMcQ6at9SoBAzTG66dPDQfGAReM4dTcNKYP7c Mv/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=IiE70BLFxFXNxVig20rcfzbtH76Q5n1o5axZXyEZUBg=; b=WHW0cRZ1i/dU5MGdtoaZV3CWSbqSFmx4tK04RxKG2GVucT6mHrIWVmN0/ZxiaVLJ1f +ye/bpNedQ3qmRVYGdojc+t1KabHvUKfjRk1lIqddxsZbKdxnvJRZ6SQPyAbV97NveVU 8zq6wN8oNSnlvMMiGmvnISbPenqcUgTzbvp0v2t0tEx2U6L8dC29x+e1xxLPTW5R2nvC V3SGKuyrbgD7/r+WCe19KgiZJBts/DACpFN5Xg1hf3Zl/KbMXfkO+D4VQeTU4zjTsQd4 1J13qPfuotFy8k7rZnpmfHAoU3dtlhv36pehTNlTpVT2802WvBk3dLrJ4PfX28VA6at6 Kqew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si257930pji.94.2019.05.27.12.20.39; Mon, 27 May 2019 12:20:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727162AbfE0Si6 (ORCPT + 99 others); Mon, 27 May 2019 14:38:58 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.61]:27534 "EHLO gateway24.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbfE0Si6 (ORCPT ); Mon, 27 May 2019 14:38:58 -0400 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 1E96451D9 for ; Mon, 27 May 2019 13:38:57 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id VKWPhWyao90onVKWPhaO79; Mon, 27 May 2019 13:38:57 -0500 X-Authority-Reason: nr=8 Received: from [189.250.47.159] (port=37440 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1hVKWO-0039DI-6Q; Mon, 27 May 2019 13:38:56 -0500 Date: Mon, 27 May 2019 13:38:55 -0500 From: "Gustavo A. R. Silva" To: "David S. Miller" Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" Subject: [PATCH net-next] macvlan: Replace strncpy() by strscpy() Message-ID: <20190527183855.GA32553@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 189.250.47.159 X-Source-L: No X-Exim-ID: 1hVKWO-0039DI-6Q X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (embeddedor) [189.250.47.159]:37440 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 8 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The strncpy() function is being deprecated. Replace it by the safer strscpy() and fix the following Coverity warning: "Calling strncpy with a maximum size argument of 16 bytes on destination array ifrr.ifr_ifrn.ifrn_name of size 16 bytes might leave the destination string unterminated." Notice that, unlike strncpy(), strscpy() always null-terminates the destination string. Addresses-Coverity-ID: 1445537 ("Buffer not null terminated") Signed-off-by: Gustavo A. R. Silva --- drivers/net/macvlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 61550122b563..0ccabde8e9c9 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -831,7 +831,7 @@ static int macvlan_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) struct ifreq ifrr; int err = -EOPNOTSUPP; - strncpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ); + strscpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ); ifrr.ifr_ifru = ifr->ifr_ifru; switch (cmd) { -- 2.21.0