bitmap: fix buffer overrun in bitmap init
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Wed, 2 Jun 2021 09:49:22 +0000 (12:49 +0300)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 11 Jun 2021 09:03:25 +0000 (11:03 +0200)
commit1ffd3bc1252ee871398dad227cd651658dc76939
treefc73b75890d65525979e526641d73934f57403b8
parent469d5c02159ddf0746ddbb9822c034556422515f
bitmap: fix buffer overrun in bitmap init

Bitmap initialization function is allowed to memset()
caller-provided buffer with number of bytes exceeded
this buffer size. This happens due to wrong comparison
sign between buffer size and number of bytes required
to initialize bitmap.

Fixes: 602c9ca33a4 ("sched: bitmap is now dynamically allocated")
Cc: stable@dpdk.org
Reported-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
lib/eal/include/rte_bitmap.h