DPDK patches and discussions
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Kulasek, TomaszX" <tomaszx.kulasek@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] app/test: fix array subscript is above array	bounds for gcc 4.5
Date: Thu, 7 Apr 2016 14:06:41 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D8973C8EBCE7@IRSMSX108.ger.corp.intel.com> (raw)
In-Reply-To: <1460037733-8284-1-git-send-email-tomaszx.kulasek@intel.com>



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tomasz Kulasek
> Sent: Thursday, April 07, 2016 3:02 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v2] app/test: fix array subscript is above array
> bounds for gcc 4.5
> 
> cc1: warnings being treated as errors
> DPDK/app/test/test_cryptodev.c: In function
> 'test_snow3g_encrypted_authenti
> cation.clone.3':
> DPDK/x86_64-ivshmem-linuxapp-gcc/include/rte_memcpy.h:796:14: error:
> array
> subscript is above array bounds
> compilation terminated due to -Wfatal-errors.
> 
> 
> ROOT OF PROBLEM:
> ----------------
> 
> In lines like:
> 
>     rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
> 
> when "iv" is 64 bytes long array, and "iv_len" is "unsigned int",
> compiler tries to evaluate also a code for array size larger than 255 bytes
> long and reports error "array subscript is above array bounds" in line:
> 
> rte_memcpy.h:796
> 
>     rte_mov128((uint8_t *)dst + 128, (const uint8_t *)src + 128);
> 
> caused by evaluation to:
> 
>     rte_mov128((uint8_t *)sym_op->cipher.iv.data + 128, (const uint8_t *)iv
> 			+ 128);
> 
> where "iv" is 64 bytes long buffer and "iv + 128" point out of it, gcc 4.5.
> 
> 
> SOLUTION:
> ---------
> 
> Using uint8_t as a size of copied block prevents to evaluate in rte_memcpy
> code for length bigger than 255, causing the problem.
> 
> v2 changes:
>  - added fixline
> 
> Fixes: 8bdf665fe6c0 ("app/test: add SNOW 3G")
> 
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

  reply	other threads:[~2016-04-07 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 13:07 [dpdk-dev] [PATCH] " Tomasz Kulasek
2016-04-07 13:15 ` De Lara Guarch, Pablo
2016-04-07 13:57   ` Kulasek, TomaszX
2016-04-07 14:02 ` [dpdk-dev] [PATCH v2] " Tomasz Kulasek
2016-04-07 14:06   ` De Lara Guarch, Pablo [this message]
2016-04-07 17:41     ` 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=E115CCD9D858EF4F90C690B0DCB4D8973C8EBCE7@IRSMSX108.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=dev@dpdk.org \
    --cc=tomaszx.kulasek@intel.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
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).