Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2043309pxj; Sun, 13 Jun 2021 06:56:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKLDhY0Ats9m64WdTK+YPCI9QXkpuiVQlMlhM5rye0sGFiQ5oSTi6BZEX21fa7WXWt7evu X-Received: by 2002:a05:6402:22f3:: with SMTP id dn19mr12772432edb.240.1623592566688; Sun, 13 Jun 2021 06:56:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623592566; cv=none; d=google.com; s=arc-20160816; b=0D7NchCUhxUvAWZzaK4HEZY0mBpOJQLAP9SPA9s6oldFGN6XCKReKU1JMMsyZBRKZ8 rB6Bx+v/z/QaMtqrRw12YWAaVdGrlMRATpv4OPe+J3q8x/ODS2DCV6IJAh45DPZrixhy JlbiJNGmVjF7vTkg9T8+yMZhFSniuNtEtK4P8JFZOMdMLOxLqDN/QWAxv22GDHh+pwvB tY2Tw2D2hwUy6y9XCivpBEkNWc8zmaDeR4txtTMHRV9LzhO0F09CiQVle2tL3GNlXdtX mXQ0fLQFUrFaaeO7NlYi6Xv1YVEaxYA+r/zxb31qwsgDtEEnTjetH52YXwo2bQgogL6L WPIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=xGbTm3QOmonFzen/vaob0hrfyXOdvbisCDKJ99+CMZM=; b=fJRWi3/dWmsNklFMRAnzi04iWJy5LNDshR8TXk6GtYr6v6TrFjUg5uhbT1E/0xkvHk MgTZeMJXWYt64K0KZV5Eff2cbZGzNmA+MDaqhgRb2/m+ePUBu6UPYt4f0Yu/xpXgaB1H fKQZjLVMjAokUvNaD4Y1UG7NrdfKeOJBbUme4wIOEDgLgC6+bIt0kM3yl+ETCB2n3rel PcYrQjxUSDXCSEzpXGCb3alGPMxgvdycUsbGEIxeL/IzDDbzy6Fd+XMOVjQMy0KNZ8Is rzVMQXjKgSo5ccQ+AOlu8k+DmZ48NlM9RjY3mcfmZWpuPr/BG9X1ZAq2R64lEconerhx ojyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si9980282ejc.291.2021.06.13.06.55.43; Sun, 13 Jun 2021 06:56:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231831AbhFMN4A (ORCPT + 99 others); Sun, 13 Jun 2021 09:56:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231755AbhFMN4A (ORCPT ); Sun, 13 Jun 2021 09:56:00 -0400 Received: from mxout017.mail.hostpoint.ch (mxout017.mail.hostpoint.ch [IPv6:2a00:d70:0:e::317]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33C5C061574; Sun, 13 Jun 2021 06:53:58 -0700 (PDT) Received: from [10.0.2.45] (helo=asmtp012.mail.hostpoint.ch) by mxout017.mail.hostpoint.ch with esmtp (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1lsQYh-000NnB-6r; Sun, 13 Jun 2021 15:53:51 +0200 Received: from [2a02:168:6182:1:d747:8127:5b7a:4266] by asmtp012.mail.hostpoint.ch with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1lsQYh-000JXF-4H; Sun, 13 Jun 2021 15:53:51 +0200 X-Authenticated-Sender-Id: reto-schneider@reto-schneider.ch Subject: Re: [PATCH v1 2/2] net: ethernet: mtk_eth_soc: Support custom ifname To: "Russell King (Oracle)" Cc: devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Stefan Roese , Reto Schneider , "David S. Miller" , Felix Fietkau , Jakub Kicinski , John Crispin , Mark Lee , Matthias Brugger , Sean Wang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210613115820.1525478-1-code@reto-schneider.ch> <20210613115820.1525478-2-code@reto-schneider.ch> <20210613122043.GP22278@shell.armlinux.org.uk> From: Reto Schneider Message-ID: Date: Sun, 13 Jun 2021 15:53:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210613122043.GP22278@shell.armlinux.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Russell, On 13.06.21 14:20, Russell King (Oracle) wrote: > Please don't use strncpy() - this is a good example why strncpy() is bad > news. > > * strncpy - Copy a length-limited, C-string > * @dest: Where to copy the string to > * @src: Where to copy the string from > * @count: The maximum number of bytes to copy > * > * The result is not %NUL-terminated if the source exceeds > * @count bytes. > > Consequently, if "name" is IFNAMSIZ bytes or longer, > eth->netdev[id]->name will not be NUL terminated, and subsequent use > will run off the end of the string. strscpy() is safer to use here. Thanks a lot for finding this (embarrassing mistake) and pointing me in the right direction (did dot know about strscpy). Will send v2 soon. Kind regards, Reto