From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: [PATCH v2 04/17] IDR test suite: Check handling negative end correctly Date: Wed, 29 Nov 2017 12:19:09 -0800 Message-ID: <20171129201922.24370-5-willy@infradead.org> References: <20171129201922.24370-1-willy@infradead.org> Cc: Matthew Wilcox To: willy@infradead.org, netdev@vger.kernel.org Return-path: Received: from bombadil.infradead.org ([65.50.211.133]:59810 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752437AbdK2UTl (ORCPT ); Wed, 29 Nov 2017 15:19:41 -0500 In-Reply-To: <20171129201922.24370-1-willy@infradead.org> Sender: netdev-owner@vger.kernel.org List-ID: From: Matthew Wilcox One of the charming quirks of the idr_alloc() interface is that you can pass a negative end and it will be interpreted as "maximum". Ensure we don't break that. Signed-off-by: Matthew Wilcox --- tools/testing/radix-tree/idr-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/radix-tree/idr-test.c b/tools/testing/radix-tree/idr-test.c index 193450b29bf0..892ef8855b02 100644 --- a/tools/testing/radix-tree/idr-test.c +++ b/tools/testing/radix-tree/idr-test.c @@ -207,6 +207,7 @@ void idr_checks(void) assert(idr_alloc(&idr, item, i, i + 10, GFP_KERNEL) == i); } assert(idr_alloc(&idr, DUMMY_PTR, i - 2, i, GFP_KERNEL) == -ENOSPC); + assert(idr_alloc(&idr, DUMMY_PTR, i - 2, i + 10, GFP_KERNEL) == -ENOSPC); idr_for_each(&idr, item_idr_free, &idr); idr_destroy(&idr); -- 2.15.0