Message ID | 20231010-strncpy-drivers-net-ethernet-intel-igbvf-netdev-c-v1-1-69ccfb2c2aa5@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp139273vqb; Tue, 10 Oct 2023 14:12:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoKFzeu/KgvFomBna9JN+lkaC6AGzyqDtQOFuI1laf0dmX40LLyBKmM0pmPxFdFcJiY61G X-Received: by 2002:a05:6a00:3916:b0:68e:2fd4:288a with SMTP id fh22-20020a056a00391600b0068e2fd4288amr21976080pfb.3.1696972352426; Tue, 10 Oct 2023 14:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696972352; cv=none; d=google.com; s=arc-20160816; b=QjR4orA+LGZrZCNX8K1Bp0mgAF33qmPD1PARxxbTkFTMzRSZkGuzej2whwy2QFs8C9 +VaKp2mfezClzBEF3s6qVlhZy+a1hbbPoxGYrOWNf2i/DsBp4CoJunMwv5BwUfF84x7j HxXaBhUnbxt+btFr0FJBrGGpQm6KNASadp0pZvGgaZv8tmfVHx+oB9FWp59q9ev5FM3F RaygPZi9EQYPDPMFeA+Ssy7AGUH9TS893dNoSb8/d6WFDuSGKogGiKvwMMx4kOrdr4OA dqVXFJD0jNq7nO0hlkLHPi1xdrAEMzRU6BXui4qqXcrKsANWLaj9TOHMFuIYgAyevGqs Tg7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=Hw4yLVcWfwcyHBWiL12H1p9pecjvnDh7ltJR9rI3BWk=; fh=KoEe/vQ6ORhGDo5TgnggqYNqVJjSCkGH3Hik0lgvoJY=; b=xSRQaOPfHbgWO76fpt9bpcWxze1Aj6nLyBAbu3Sv3DTmRgrLA8xV7nueMQhhJTwhjb oOKS1Ip6EMzQLNoRgNFLTzSPzIDHQN33OFwrMpsbhdGMos2kFXSNO9OfpO2yu/2o53aJ MPYGHqGnh4EHmrQ43csRhVkuQbuI6PsDeFuLvTnX5uEzvCniOwjfpgZI8iQN4c6SMSjt kzTuXoOTDIHYdunrMDQaGmssWQYpevc7NO5sj85vXKgcXo7pfMv4hCx9+TKs/cmHs3XS PVDp+Gpj7Jc86NwFZvYBvkCFWuPuAGu70+z2u2F9jY+0DjccIW58uI0XMxv2V9LgpICC B/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="nA/teSCb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id x15-20020aa793af000000b0068fb4615f09si9136855pff.328.2023.10.10.14.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 14:12:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="nA/teSCb"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 80C81807F4BB; Tue, 10 Oct 2023 14:12:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343813AbjJJVMF (ORCPT <rfc822;rua109.linux@gmail.com> + 19 others); Tue, 10 Oct 2023 17:12:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjJJVME (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Oct 2023 17:12:04 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C607194 for <linux-kernel@vger.kernel.org>; Tue, 10 Oct 2023 14:12:01 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-59f7d109926so93964977b3.2 for <linux-kernel@vger.kernel.org>; Tue, 10 Oct 2023 14:12:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696972321; x=1697577121; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=Hw4yLVcWfwcyHBWiL12H1p9pecjvnDh7ltJR9rI3BWk=; b=nA/teSCbf8g6xSZW1SxheJx8Xs3cO7jmKjy5gN21VKtp8GmofGDP3uP2pMcmdFLM2+ fUclvlV/Ypt4v3FR+w+dHv7258vecIU0UodCUsm19iB87dciRsU8Dg4V09rg3hHD3cfa 5lDN0j8uzKE5BK2djtz7FZSXdDyCNWweuQNmPvpdG83vJtbtHAS0Q8XbPAVdSE8RngfA fXIqHKXu/hFSRd+4Ze3yc8bCdq7l5JYMN6KCzUB54N3VYZ6WYEiTeFTwng1w12cBl+Ff 9sCEdcdSCZFOCcK2kIh+fN4Kmyfp0Q006nJvfbzFagSHOJxqF8Mqta9r1ytQUeV4T7KT lMpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696972321; x=1697577121; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Hw4yLVcWfwcyHBWiL12H1p9pecjvnDh7ltJR9rI3BWk=; b=kB2iSaKR0o+le/rCZF55HBrrUx221ic0oQid/93rFrA+VqcR5TMUIrl8N5ap8ys1i9 0V9/QB12Fx/aC3iZWSqJHK/HgFq5wmGD7clT60LLW6DdHHLthnhKCfQ7ooXHi8wV+MNW cCJwr/iYkOm/YTgxegj+zW+MCH3biPFlFlMNaPf42/d1Rd8t08ryRdGm7nZwVzIDPgPt XNX4ZOhEHhY5lbkhO16Hmxk5s1v4tZ5H9imwfhOx6xMpp7KQ07Lt6a8MdY0FNhjiuLgb pK1wnqATCgP3WvS+b8Fjw/HXsxgXwJSXCmHy0/rk6f12OaIgoZ8O3L6HoE3uEmK02LIT cllQ== X-Gm-Message-State: AOJu0YyaQFSKdAKSgnzrmwJMrOD2xUAMHWO4Ufj5XpLHTsd6W0NJbCx3 BfSZcbzImCumERhTriSHCro7IIZAU3mqQXbccw== X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) (user=justinstitt job=sendgmr) by 2002:a05:690c:2a0f:b0:5a7:aa51:c08e with SMTP id ei15-20020a05690c2a0f00b005a7aa51c08emr94672ywb.1.1696972320943; Tue, 10 Oct 2023 14:12:00 -0700 (PDT) Date: Tue, 10 Oct 2023 21:12:00 +0000 Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAB++JWUC/x2N0QrCMBAEf6XcswdJrCD+ivhwJtv2QGK5hKCU/ rupbzMM7G5UYIpCt2EjQ9Oi79zFnwaKi+QZrKk7BRfO3nnHpVqO65eTaYMVzqiMusAO0FzxYp2 fbTpCQuPIAhkvo/irhER9dzVM+vl/3h/7/gPAZza6gwAAAA== X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1696972320; l=2145; i=justinstitt@google.com; s=20230717; h=from:subject:message-id; bh=oGaWK4GP1PQLCGPw7gir9mj5QFry1WylDMUmi7PoCMI=; b=AlIp0TwJFUsw0WGPci9gswgAfJCtFnHNLhXeagjOm+3FqL5bLrOm+uMa5Gg99nXKXa7/Ix9On NnZjUs9WY8mCHt2dUpsIxoumeQaXVg1wJ6aTUJb96SAVeKft4Gof5nT X-Mailer: b4 0.12.3 Message-ID: <20231010-strncpy-drivers-net-ethernet-intel-igbvf-netdev-c-v1-1-69ccfb2c2aa5@google.com> Subject: [PATCH] igbvf: replace deprecated strncpy with strscpy From: Justin Stitt <justinstitt@google.com> To: Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Justin Stitt <justinstitt@google.com> Content-Type: text/plain; charset="utf-8" X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 10 Oct 2023 14:12:27 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779404481301275069 X-GMAIL-MSGID: 1779404481301275069 |
Series |
igbvf: replace deprecated strncpy with strscpy
|
|
Commit Message
Justin Stitt
Oct. 10, 2023, 9:12 p.m. UTC
`strncpy` is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.
We expect netdev->name to be NUL-terminated based on its usage with
`strlen` and format strings:
| if (strlen(netdev->name) < (IFNAMSIZ - 5)) {
| sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name);
Moreover, we do not need NUL-padding as netdev is already
zero-allocated:
| netdev = alloc_etherdev(sizeof(struct igbvf_adapter));
...
alloc_etherdev() -> alloc_etherdev_mq() -> alloc_etherdev_mqs() ->
alloc_netdev_mqs() ...
| p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL);
Considering the above, a suitable replacement is `strscpy` [2] due to
the fact that it guarantees NUL-termination on the destination buffer
without unnecessarily NUL-padding.
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
---
Note: build-tested only.
---
drivers/net/ethernet/intel/igbvf/netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2
change-id: 20231010-strncpy-drivers-net-ethernet-intel-igbvf-netdev-c-aea454a18a2d
Best regards,
--
Justin Stitt <justinstitt@google.com>
Comments
On 10/10/2023 2:12 PM, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect netdev->name to be NUL-terminated based on its usage with > `strlen` and format strings: > | if (strlen(netdev->name) < (IFNAMSIZ - 5)) { > | sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); > > Moreover, we do not need NUL-padding as netdev is already > zero-allocated: > | netdev = alloc_etherdev(sizeof(struct igbvf_adapter)); > ... > alloc_etherdev() -> alloc_etherdev_mq() -> alloc_etherdev_mqs() -> > alloc_netdev_mqs() ... > | p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL); > > Considering the above, a suitable replacement is `strscpy` [2] due to > the fact that it guarantees NUL-termination on the destination buffer > without unnecessarily NUL-padding. > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt <justinstitt@google.com> > --- Thanks Justin for these patches, please make sure you mark the subject line as per the netdev rules: [PATCH net-next v1] etc etc I'd also prefer they came in as part of one series with a good cover letter, at the very least for the Intel drivers, and you probably could combine any others (netdev) together up to the 15 patch limit. Please mention how you found these issues, via automated tool or via coccinelle script, manual grepping, etc? Thanks, Jesse
On 10/10/2023 2:20 PM, Jesse Brandeburg wrote: > On 10/10/2023 2:12 PM, Justin Stitt wrote: >> `strncpy` is deprecated for use on NUL-terminated destination strings >> [1] and as such we should prefer more robust and less ambiguous string >> interfaces. >> >> We expect netdev->name to be NUL-terminated based on its usage with >> `strlen` and format strings: >> | if (strlen(netdev->name) < (IFNAMSIZ - 5)) { >> | sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); >> >> Moreover, we do not need NUL-padding as netdev is already >> zero-allocated: >> | netdev = alloc_etherdev(sizeof(struct igbvf_adapter)); >> ... >> alloc_etherdev() -> alloc_etherdev_mq() -> alloc_etherdev_mqs() -> >> alloc_netdev_mqs() ... >> | p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL); >> >> Considering the above, a suitable replacement is `strscpy` [2] due to >> the fact that it guarantees NUL-termination on the destination buffer >> without unnecessarily NUL-padding. >> >> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] >> Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] >> Link: https://github.com/KSPP/linux/issues/90 >> Cc: linux-hardening@vger.kernel.org >> Signed-off-by: Justin Stitt <justinstitt@google.com> >> --- > > Thanks Justin for these patches, please make sure you mark the subject > line as per the netdev rules: > [PATCH net-next v1] etc etc > > I'd also prefer they came in as part of one series with a good cover > letter, at the very least for the Intel drivers, and you probably could > combine any others (netdev) together up to the 15 patch limit. > > Please mention how you found these issues, via automated tool or via > coccinelle script, manual grepping, etc? > > Thanks, > Jesse netdev rules: https://docs.kernel.org/process/maintainer-netdev.html Also, please see my related series, that will probably conflict with your changes but the two are making different changes. https://lore.kernel.org/netdev/20231003183603.3887546-1-jesse.brandeburg@intel.com/
On Tue, Oct 10, 2023 at 2:20 PM Jesse Brandeburg <jesse.brandeburg@intel.com> wrote: > > On 10/10/2023 2:12 PM, Justin Stitt wrote: > > `strncpy` is deprecated for use on NUL-terminated destination strings > > [1] and as such we should prefer more robust and less ambiguous string > > interfaces. > > > > We expect netdev->name to be NUL-terminated based on its usage with > > `strlen` and format strings: > > | if (strlen(netdev->name) < (IFNAMSIZ - 5)) { > > | sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); > > > > Moreover, we do not need NUL-padding as netdev is already > > zero-allocated: > > | netdev = alloc_etherdev(sizeof(struct igbvf_adapter)); > > ... > > alloc_etherdev() -> alloc_etherdev_mq() -> alloc_etherdev_mqs() -> > > alloc_netdev_mqs() ... > > | p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL); > > > > Considering the above, a suitable replacement is `strscpy` [2] due to > > the fact that it guarantees NUL-termination on the destination buffer > > without unnecessarily NUL-padding. > > > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > > Link: https://github.com/KSPP/linux/issues/90 > > Cc: linux-hardening@vger.kernel.org > > Signed-off-by: Justin Stitt <justinstitt@google.com> > > --- > > Thanks Justin for these patches, please make sure you mark the subject > line as per the netdev rules: > [PATCH net-next v1] etc etc Sure, I'll resend! > > I'd also prefer they came in as part of one series with a good cover > letter, at the very least for the Intel drivers, and you probably could > combine any others (netdev) together up to the 15 patch limit. Got it :) > > Please mention how you found these issues, via automated tool or via > coccinelle script, manual grepping, etc? rg "strncpy\(" > pain.txt > > Thanks, > Jesse >
On Tue, Oct 10, 2023 at 09:12:00PM +0000, Justin Stitt wrote: > `strncpy` is deprecated for use on NUL-terminated destination strings > [1] and as such we should prefer more robust and less ambiguous string > interfaces. > > We expect netdev->name to be NUL-terminated based on its usage with > `strlen` and format strings: > | if (strlen(netdev->name) < (IFNAMSIZ - 5)) { > | sprintf(adapter->tx_ring->name, "%s-tx-0", netdev->name); > > Moreover, we do not need NUL-padding as netdev is already > zero-allocated: > | netdev = alloc_etherdev(sizeof(struct igbvf_adapter)); > ... > alloc_etherdev() -> alloc_etherdev_mq() -> alloc_etherdev_mqs() -> > alloc_netdev_mqs() ... > | p = kvzalloc(alloc_size, GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL); > > Considering the above, a suitable replacement is `strscpy` [2] due to > the fact that it guarantees NUL-termination on the destination buffer > without unnecessarily NUL-padding. > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt <justinstitt@google.com> > --- > Note: build-tested only. > --- > drivers/net/ethernet/intel/igbvf/netdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c > index 7ff2752dd763..fd712585af27 100644 > --- a/drivers/net/ethernet/intel/igbvf/netdev.c > +++ b/drivers/net/ethernet/intel/igbvf/netdev.c > @@ -2785,7 +2785,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > > igbvf_set_ethtool_ops(netdev); > netdev->watchdog_timeo = 5 * HZ; > - strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); > + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); > > adapter->bd_number = cards_found++; > > > --- > base-commit: cbf3a2cb156a2c911d8f38d8247814b4c07f49a2 > change-id: 20231010-strncpy-drivers-net-ethernet-intel-igbvf-netdev-c-aea454a18a2d > > Best regards, > -- > Justin Stitt <justinstitt@google.com> > Hi, this patch was bundled up with some others. It has a new home: https://lore.kernel.org/all/20231010-netdev-replace-strncpy-resend-as-series-v1-0-caf9f0f2f021@google.com/
On Tue, 10 Oct 2023 14:41:10 -0700 Justin Stitt wrote: > > Thanks Justin for these patches, please make sure you mark the subject > > line as per the netdev rules: > > [PATCH net-next v1] etc etc > > Sure, I'll resend! Please do read the netdev rules Jesse pointed you at. Maybe it's the combined flow of strncpy and __counted_by patches but managing the state of the "hardening" patches is getting a bit tedious :( Please group them into reasonable series. Do not repost withing 24h. Do not have more than 15 patches for networking pending at any given time. That's basically the gist of our "good citizen" rules.
On Tue, 10 Oct 2023 17:47:31 -0700 Jakub Kicinski wrote: > Please do read the netdev rules Jesse pointed you at. > Maybe it's the combined flow of strncpy and __counted_by patches > but managing the state of the "hardening" patches is getting > a bit tedious :( > > Please group them into reasonable series. Do not repost withing 24h. > Do not have more than 15 patches for networking pending at any given > time. That's basically the gist of our "good citizen" rules. FWIW you can see how many pending patches you have pending in netdev using this here link: https://patchwork.kernel.org/project/netdevbpf/list/?submitter=206354
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 7ff2752dd763..fd712585af27 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c @@ -2785,7 +2785,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) igbvf_set_ethtool_ops(netdev); netdev->watchdog_timeo = 5 * HZ; - strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1); + strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); adapter->bd_number = cards_found++;