From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752256AbbIJHiK (ORCPT ); Thu, 10 Sep 2015 03:38:10 -0400 Received: from smtprelay0182.hostedemail.com ([216.40.44.182]:53496 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751101AbbIJHiI (ORCPT ); Thu, 10 Sep 2015 03:38:08 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:973: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:2689:2693:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6119:6261:7903:8603:10004:10400:10848:11232:11658:11914:12043:12296:12438:12517:12519:12555:12663:12740:13069:13095:13311:13357:14096:14097:21060: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: wish66_63d3c0ce63207 X-Filterd-Recvd-Size: 2751 Message-ID: <1441870684.17219.132.camel@perches.com> Subject: Re: [PATCH] lib/vsprintf.c: increase the size of the field_width variable From: Joe Perches To: Maurizio Lombardi Cc: Rasmus Villemoes , akpm@linux-foundation.org, tj@kernel.org, linux-kernel@vger.kernel.org Date: Thu, 10 Sep 2015 00:38:04 -0700 In-Reply-To: <55F12B94.30503@redhat.com> References: <1441793590-23856-1-git-send-email-mlombard@redhat.com> <1441816432.17219.57.camel@perches.com> <87mvwv4ea2.fsf@rasmusvillemoes.dk> <55F12B94.30503@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 Thu, 2015-09-10 at 09:04 +0200, Maurizio Lombardi wrote: > Hi Rasmus, > > On 09/09/2015 08:51 PM, Rasmus Villemoes wrote: > > I'm also a little confused; I don't see what printk has to do with the > > reported problem (I'd expect the /sys/... file to be generated by > > something like seq_printf). > > In the scsi-debug case scnprintf is used, but it doesn't really matter > because the change I made would influence printk and all its friends as > well... everything that will parse "%*pb[l]". > > > > >> %*pb is meant for smallish bitmaps, not big ones. > > > > Yup. And that leads to my other confusion: Given that the expected > > output is given as "0-15", does the bitmap really consist of > S16_MAX > > bits with only the first 16 set? > > > > Yes. To be precise, in the example I mentioned in the commit message, a > bitmap of size = 524288 bits is created. > If you assign this number to a s16 variable the result will be zero and > nothing will be printed. Maurizio, did you try the patch I posted? I think it'll work, but it doesn't fix the fundamental issue of %*pbl with large bitmaps. vsnprintf / printk as used in the kernel does have limitations that user mode vsnprintf does not. > Joe, you mentioned that *pbl is meant for small bitmaps, what should I > use with big ones? Something else? > scsi-debug used the bitmap_scnlistprintf() function but since commit > dbc760bcc150cc27160f0131b15db76350df4334 this function is just a wrapper > around scnprintf("%*pbl"); > as a consequence, the scsi-debug map_show() function stopped working > correctly. Perhaps the thin wrapper conversions in lib/bitmap.c in that commit for bitmap_scnprintf, bscnl_emit, and bitmap_scnlistprintf should be reverted.