DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dpdk-dev <dev@dpdk.org>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	 "K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Long Li <longli@microsoft.com>,
	Raslan Darawsheh <rasland@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH] net/netvsc: replace compiler builtin overflow check
Date: Wed, 9 Sep 2020 15:05:01 -0700
Message-ID: <CACZ4nhuVS1PuMn19W2qSAg5JDtVk_ihhBAYPu3NjkRdhbKTZRA@mail.gmail.com> (raw)
In-Reply-To: <20200908100642.1197765-1-ferruh.yigit@intel.com>

On Tue, Sep 8, 2020 at 3:07 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> '__builtin_add_overflow' added to gcc in version 5, earlier versions
> causing build error, like gcc 4.8.5 in RHEL7.
>
> Replaced compiler builtin check with arithmetic check.
>
> Fixes: cabb3c0f29f1 ("net/netvsc: check for overflow on packet info from
> host")
>
> Reported-by: Raslan Darawsheh <rasland@mellanox.com>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
Tested-by: Ajit Khaparde <ajit.khaparde@broadcom.com>


> ---
>  drivers/net/netvsc/hn_rxtx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
> index d8d3f07f56..3e8d3b407d 100644
> --- a/drivers/net/netvsc/hn_rxtx.c
> +++ b/drivers/net/netvsc/hn_rxtx.c
> @@ -666,7 +666,7 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq,
>                              struct hn_rx_bufinfo *rxb,
>                              void *data, uint32_t dlen)
>  {
> -       unsigned int data_off, data_len, total_len;
> +       unsigned int data_off, data_len;
>         unsigned int pktinfo_off, pktinfo_len;
>         const struct rndis_packet_msg *pkt = data;
>         struct hn_rxinfo info = {
> @@ -712,8 +712,8 @@ static void hn_rndis_rx_data(struct hn_rx_queue *rxq,
>                         goto error;
>         }
>
> -       if (__builtin_add_overflow(data_off, data_len, &total_len) ||
> -           total_len > pkt->len)
> +       /* overflow check */
> +       if (data_len > data_len + data_off || data_len + data_off >
> pkt->len)
>                 goto error;
>
>         if (unlikely(data_len < RTE_ETHER_HDR_LEN))
> --
> 2.25.4
>
>

      parent reply	other threads:[~2020-09-09 22:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 10:06 Ferruh Yigit
2020-09-08 12:06 ` Raslan Darawsheh
2020-09-08 15:47 ` Stephen Hemminger
2020-09-10 17:16   ` Ferruh Yigit
2020-09-09 22:05 ` Ajit Khaparde [this message]

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=CACZ4nhuVS1PuMn19W2qSAg5JDtVk_ihhBAYPu3NjkRdhbKTZRA@mail.gmail.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=longli@microsoft.com \
    --cc=rasland@mellanox.com \
    --cc=sthemmin@microsoft.com \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git