From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8CB92A0A02 for ; Wed, 2 Jun 2021 11:06:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D56E410DF; Wed, 2 Jun 2021 11:06:49 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 9FB4E40689; Wed, 2 Jun 2021 11:06:46 +0200 (CEST) Received: by shelob.oktetlabs.ru (Postfix, from userid 122) id 2C1117F57E; Wed, 2 Jun 2021 12:06:46 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=ALL_TRUSTED, DKIM_ADSP_DISCARD, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17]) by shelob.oktetlabs.ru (Postfix) with ESMTP id E07B37F4FE; Wed, 2 Jun 2021 12:06:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru E07B37F4FE Authentication-Results: shelob.oktetlabs.ru/E07B37F4FE; dkim=none; dkim-atps=neutral From: Andrew Rybchenko To: Cristian Dumitrescu Cc: dev@dpdk.org, Ivan Ilchenko , stable@dpdk.org, Andy Moreton Date: Wed, 2 Jun 2021 12:06:29 +0300 Message-Id: <20210602090629.3495940-1-andrew.rybchenko@oktetlabs.ru> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH] bitmap: fix buffer overrun in bitmap init function X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Ivan Ilchenko Bitmap initialization function is allowed to memset caller-provided buffer with number of bytes exceeded this buffer size. This happens due to wrong comparision 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 Signed-off-by: Ivan Ilchenko Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- lib/eal/include/rte_bitmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/include/rte_bitmap.h b/lib/eal/include/rte_bitmap.h index 9e2b8f2cbf..870aecc594 100644 --- a/lib/eal/include/rte_bitmap.h +++ b/lib/eal/include/rte_bitmap.h @@ -185,7 +185,7 @@ rte_bitmap_init(uint32_t n_bits, uint8_t *mem, uint32_t mem_size) size = __rte_bitmap_get_memory_footprint(n_bits, &array1_byte_offset, &array1_slabs, &array2_byte_offset, &array2_slabs); - if (size < mem_size) { + if (size > mem_size) { return NULL; } -- 2.30.2