From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754404AbbIIQd5 (ORCPT ); Wed, 9 Sep 2015 12:33:57 -0400 Received: from smtprelay0142.hostedemail.com ([216.40.44.142]:36041 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753296AbbIIQdz (ORCPT ); Wed, 9 Sep 2015 12:33:55 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3871:3872:4321:5007:6261:8603:8957:10004:10400:10848:11026:11232:11657:11658:11914:12043:12296:12517:12519:12740:13069:13138:13231:13311:13357:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: train12_3f0c2ec4f0e32 X-Filterd-Recvd-Size: 1965 Message-ID: <1441816432.17219.57.camel@perches.com> Subject: Re: [PATCH] lib/vsprintf.c: increase the size of the field_width variable From: Joe Perches To: Maurizio Lombardi Cc: akpm@linux-foundation.org, linux@rasmusvillemoes.dk, tj@kernel.org, linux-kernel@vger.kernel.org Date: Wed, 09 Sep 2015 09:33:52 -0700 In-Reply-To: <1441793590-23856-1-git-send-email-mlombard@redhat.com> References: <1441793590-23856-1-git-send-email-mlombard@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2015-09-09 at 12:13 +0200, Maurizio Lombardi wrote: > When printing a bitmap using the "%*pb[l]" printk format > a 16 bit variable (field_width) is used to store the size of the bitmap. > In some cases 16 bits are not sufficient, the variable overflows and > printk does not work as expected. If more than 16 bits are necessary, it couldn't work as a single printk is limited to 1024 bytes. > 3. Bitmap should be set, but still empty > # cat /sys/bus/pseudo/drivers/scsi_debug/map [] > diff --git a/lib/vsprintf.c b/lib/vsprintf.c [] > @@ -384,8 +384,8 @@ struct printf_spec { > u8 flags; /* flags to number() */ > u8 base; /* number base, 8, 10 or 16 only */ > u8 qualifier; /* number qualifier, one of 'hHlLtzZ' */ > - s16 field_width; /* width of output field */ > s16 precision; /* # of digits/chars */ > + s32 field_width; /* width of output field */ > }; > > static noinline_for_stack And this makes the sizeof struct printf_spec more than 8 bytes which isn't desireable on x86-32. %*pb is meant for smallish bitmaps, not big ones.