From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754306AbbLCUyX (ORCPT ); Thu, 3 Dec 2015 15:54:23 -0500 Received: from smtprelay0156.hostedemail.com ([216.40.44.156]:56178 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754258AbbLCUyT (ORCPT ); Thu, 3 Dec 2015 15:54:19 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::,RULES_HIT:41:355:379:541:599:967:973:981:988:989:1260:1263:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2525:2560:2563:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4362:5007:6119:6261:7875:7903:8599:8603:9025:10004:10400:10848:11232:11658:11914:12043:12048:12296:12438:12517:12519:12555:12740:13069:13138:13231:13311:13357:14659:21080:30012:30054:30070:30091,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,LFtime:2,LUA_SUMMARY:none X-HE-Tag: tramp25_70aa85ea6137 X-Filterd-Recvd-Size: 2551 Message-ID: <1449176047.17296.4.camel@perches.com> Subject: Re: [PATCH v3 04/14] lib/vsprintf.c: expand field_width to 24 bits From: Joe Perches To: Rasmus Villemoes , Andrew Morton , Andy Shevchenko , Kees Cook , Martin Kletzander Cc: Andy Shevchenko , Maurizio Lombardi , Tejun Heo , linux-kernel@vger.kernel.org Date: Thu, 03 Dec 2015 12:54:07 -0800 In-Reply-To: <1449175873-1780-5-git-send-email-linux@rasmusvillemoes.dk> References: <1449175873-1780-1-git-send-email-linux@rasmusvillemoes.dk> <1449175873-1780-5-git-send-email-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.2-0ubuntu2 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 Thu, 2015-12-03 at 21:51 +0100, Rasmus Villemoes wrote: > Maurizio Lombardi reported a problem [1] with the %pb extension: It > doesn't work for sufficiently large bitmaps, since the size is stashed > in the field_width field of the struct printf_spec, which is currently > an s16. Concretely, this manifested itself in > /sys/bus/pseudo/drivers/scsi_debug/map being empty, since the bitmap > printer got a size of 0, which is the 16 bit truncation of the actual > bitmap size. > > We do want to keep struct printf_spec at 8 bytes so that it can > cheaply be passed by value. The qualifier field is only used for > internal bookkeeping in format_decode, so we might as well use a local > variable for that. This gives us an additional 8 bits, which we can > then use for the field width. > > To stay in 8 bytes, we need to do a little rearranging and make the > type member a bitfield as well. For consistency, change all the > members to bit fields. gcc doesn't generate much worse code with these > changes (in fact, bloat-o-meter says we save 300 bytes - which I think > is a little surprising). > > I didn't find a BUILD_BUG/compiletime_assertion/... which would work > outside function context, so for now I just open-coded it. > > [1] http://thread.gmane.org/gmane.linux.kernel/2034835 Thanks for keeping at this Rasmus. This seems quite reasonable.