summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPablo de Lara <pablo.de.lara.guarch@intel.com>2016-04-12 11:04:03 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-06-07 22:21:52 +0200
commit37ebd9e12dd585a9472c254499135fedabf5aa06 (patch)
tree115334811614692674543914c133719feb780f5f /examples
parent5c1824f6ed6de9d2aacd071d4539400120bd6ba8 (diff)
downloaddpdk-37ebd9e12dd585a9472c254499135fedabf5aa06.zip
dpdk-37ebd9e12dd585a9472c254499135fedabf5aa06.tar.gz
dpdk-37ebd9e12dd585a9472c254499135fedabf5aa06.tar.xz
examples/l2fwd-crypto: fix supported key size check
When initializing crypto devices within the app, the provided key sizes are checked against the supported sizes from the crypto device capabilities. When the supported sizes are not a range, but a single value, the check may become an infinite loop (when size is not supported). Fixes: a061e50a0d97 ("examples/l2fwd-crypto: fix ambiguous input key size") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Tested-by: Min Cao <min.cao@intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/l2fwd-crypto/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index c4cd98d..e539559 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -1489,6 +1489,15 @@ check_supported_size(uint16_t length, uint16_t min, uint16_t max,
{
uint16_t supp_size;
+ /* Single value */
+ if (increment == 0) {
+ if (length == min)
+ return 0;
+ else
+ return -1;
+ }
+
+ /* Range of values */
for (supp_size = min; supp_size <= max; supp_size += increment) {
if (length == supp_size)
return 0;