DPDK patches and discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] kni: fix build with gcc 8.1
Date: Wed, 20 Jun 2018 09:01:22 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D8977F8D8C3B@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <20180619120855.78207-1-ferruh.yigit@intel.com>



> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Tuesday, June 19, 2018 1:09 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-stable] [PATCH] kni: fix build with gcc 8.1
> 
> Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is
> enabled.
> 
> build error:
> In function ‘strncpy’,
>     inlined from ‘igb_get_drvinfo’ at
>     .../dpdk/build/build/kernel/linux/kni/igb_ethtool.c:814:2:
>     .../include/linux/string.h:246:9: error: ‘__builtin_strncpy’ output
>     may be truncated copying 31 bytes from a string of length 42
>     [-Werror=stringop-truncation]
>       return __builtin_strncpy(p, q, size);
>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Fixed by reducing the adapter->fw_version size and adjusting strncpy limit size.
> 
> Cc: stable@dpdk.org
>

Fixes line?
 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

...

> --- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
> +++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
> @@ -812,7 +812,7 @@ static void igb_get_drvinfo(struct net_device *netdev,
>  	strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) -
> 1);
> 
>  	strncpy(drvinfo->fw_version, adapter->fw_version,
> -		sizeof(drvinfo->fw_version) - 1);
> +		sizeof(drvinfo->fw_version));
>  	strncpy(drvinfo->bus_info, pci_name(adapter->pdev), sizeof(drvinfo-
> >bus_info) -1);

This patch fixes the compilation issue, but should we use strlcpy instead of strncpy?

Thanks,
Pablo


  parent reply	other threads:[~2018-06-20  9:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 12:08 [dpdk-dev] " Ferruh Yigit
2018-06-19 23:35 ` Stephen Hemminger
2018-06-20 16:39   ` Ferruh Yigit
2018-06-20 17:04     ` Ferruh Yigit
2018-06-20  9:01 ` De Lara Guarch, Pablo [this message]
2018-06-20 16:40   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2018-06-26  9:02 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2018-06-26  9:54   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-06-26 11:38   ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2018-06-26 13:43     ` De Lara Guarch, Pablo
2018-06-27 13:15       ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E115CCD9D858EF4F90C690B0DCB4D8977F8D8C3B@IRSMSX108.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).