From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754264AbbLCUwH (ORCPT ); Thu, 3 Dec 2015 15:52:07 -0500 Received: from mail-lb0-f173.google.com ([209.85.217.173]:33956 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754195AbbLCUwB (ORCPT ); Thu, 3 Dec 2015 15:52:01 -0500 From: Rasmus Villemoes To: Andrew Morton , Rasmus Villemoes , Kees Cook Cc: Maurizio Lombardi , Tejun Heo , linux-kernel@vger.kernel.org Subject: [PATCH v3 13/14] lib/test_printf.c: add test for large bitmaps Date: Thu, 3 Dec 2015 21:51:12 +0100 Message-Id: <1449175873-1780-14-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1449175873-1780-1-git-send-email-linux@rasmusvillemoes.dk> References: <1449175873-1780-1-git-send-email-linux@rasmusvillemoes.dk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Following "lib/vsprintf.c: expand field_width to 24 bits", let's add a test to see that we now actually support bitmaps with 65536 bits. Cc: Maurizio Lombardi Cc: Tejun Heo Acked-by: Kees Cook Signed-off-by: Rasmus Villemoes --- lib/test_printf.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/test_printf.c b/lib/test_printf.c index 3e21170d327d..60740c10c3e8 100644 --- a/lib/test_printf.c +++ b/lib/test_printf.c @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -341,6 +342,20 @@ struct_clk(void) } static void __init +large_bitmap(void) +{ + const int nbits = 1 << 16; + unsigned long *bits = kcalloc(BITS_TO_LONGS(nbits), sizeof(long), GFP_KERNEL); + if (!bits) + return; + + bitmap_set(bits, 1, 20); + bitmap_set(bits, 60000, 15); + test("1-20,60000-60014", "%*pbl", nbits, bits); + kfree(bits); +} + +static void __init bitmap(void) { DECLARE_BITMAP(bits, 20); @@ -359,6 +374,8 @@ bitmap(void) bitmap_fill(bits, 20); test("fffff|fffff", "%20pb|%*pb", bits, 20, bits); test("0-19|0-19", "%20pbl|%*pbl", bits, 20, bits); + + large_bitmap(); } static void __init -- 2.6.1