DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test: fix array overflow warning with gcc 4.5
@ 2016-06-09 11:14 Tomasz Kulasek
  2016-06-13 20:04 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Kulasek @ 2016-06-09 11:14 UTC (permalink / raw)
  To: declan.doherty, arkadiuszx.kusztal; +Cc: dev

DPDK/app/test/test_cryptodev.c: In function ‘create_snow3g_cipher_operation
_oop.clone.15’: DPDK/x86_64-native-linuxapp-gcc/include/rte_memcpy.h:796:14
error: array subscript is above array bounds.

In test_cryptodev.c:
2429	rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);

When iv_len is declared as 'unsigned int', rte_memcpy evaluates code for
buffer size bigger than 255, but while 'iv' array is 64 bytes long, it
causes 'above array bounds' warning in gcc 4.5 and breaks compilation.

Using uint8_t as a size of copied block prevents to evaluate in rte_memcpy
code for length bigger than 255, causing the problem.

The root of this issue and solution is the same as for commit 2c007ea10616
("app/test: fix array overflow warning with gcc 4.5")

Fixes: 9727af14b032 ("app/test: add out-of-place symmetric crypto
       operations")

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
---
 app/test/test_cryptodev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 45e6daa..6621573 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2392,7 +2392,7 @@ create_snow3g_cipher_operation(const uint8_t *iv, const unsigned iv_len,
 }
 
 static int
-create_snow3g_cipher_operation_oop(const uint8_t *iv, const unsigned iv_len,
+create_snow3g_cipher_operation_oop(const uint8_t *iv, const uint8_t iv_len,
 			const unsigned cipher_len,
 			const unsigned cipher_offset)
 {
-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] app/test: fix array overflow warning with gcc 4.5
  2016-06-09 11:14 [dpdk-dev] [PATCH] app/test: fix array overflow warning with gcc 4.5 Tomasz Kulasek
@ 2016-06-13 20:04 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-06-13 20:04 UTC (permalink / raw)
  To: Tomasz Kulasek; +Cc: dev, declan.doherty, arkadiuszx.kusztal

2016-06-09 13:14, Tomasz Kulasek:
> DPDK/app/test/test_cryptodev.c: In function ‘create_snow3g_cipher_operation
> _oop.clone.15’: DPDK/x86_64-native-linuxapp-gcc/include/rte_memcpy.h:796:14
> error: array subscript is above array bounds.
> 
> In test_cryptodev.c:
> 2429	rte_memcpy(sym_op->cipher.iv.data, iv, iv_len);
> 
> When iv_len is declared as 'unsigned int', rte_memcpy evaluates code for
> buffer size bigger than 255, but while 'iv' array is 64 bytes long, it
> causes 'above array bounds' warning in gcc 4.5 and breaks compilation.
> 
> Using uint8_t as a size of copied block prevents to evaluate in rte_memcpy
> code for length bigger than 255, causing the problem.
> 
> The root of this issue and solution is the same as for commit 2c007ea10616
> ("app/test: fix array overflow warning with gcc 4.5")
> 
> Fixes: 9727af14b032 ("app/test: add out-of-place symmetric crypto
>        operations")
> 
> Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-13 20:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-09 11:14 [dpdk-dev] [PATCH] app/test: fix array overflow warning with gcc 4.5 Tomasz Kulasek
2016-06-13 20:04 ` Thomas Monjalon

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).