ivshmem: fix crash in corner case
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Thu, 18 Jun 2015 12:27:30 +0000 (13:27 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 22 Jun 2015 16:39:40 +0000 (18:39 +0200)
commitcda3f638c348b4ad35eb2492bf2ff8e1296f1489
tree5362e380fbfbbfd7e1656994d920af18f5fe4b66
parent3913d96a04fc01b483a3ad4fd06472bb3690cf1d
ivshmem: fix crash in corner case

Depending on the configured segments it is possible to hit a
segmentation fault as a result of decrementing an unsigned index with
value 0.

To avoid it, exit the loop if the index has value 0.

Fixes: 40b966a211ab ("ivshmem: library changes for mmaping using ivshmem")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
lib/librte_ivshmem/rte_ivshmem.c