From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752539AbcF3Psh (ORCPT ); Thu, 30 Jun 2016 11:48:37 -0400 Received: from smtprelay0206.hostedemail.com ([216.40.44.206]:58417 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751665AbcF3Psg (ORCPT ); Thu, 30 Jun 2016 11:48:36 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3354:3622:3865:3866:3870:3871:3872:4321:4362:5007:6119:6261:7875:8603:8784:10004:10394:10400:10848:10967:11026:11232:11473:11658:11914:12043:12296:12517:12519:12555:12740:13069:13311:13357:13439:14181:14659:14721:21080:30003:30054:30090: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: shirt67_679100879df23 X-Filterd-Recvd-Size: 2961 Date: Thu, 30 Jun 2016 11:48:30 -0400 From: Steven Rostedt To: Jiri Olsa Cc: linux-kernel@vger.kernel.org, Andrew Morton , Rasmus Villemoes , Frederic Weisbecker , Andy Shevchenko , Jiri Olsa Subject: Re: [RFC][PATCH 3/3] vsprintf: Add support for %pb and friends to vbin_printf() Message-ID: <20160630114830.49b18e55@gandalf.local.home> In-Reply-To: <20160630145634.GA2992@krava> References: <20160629200522.686965980@goodmis.org> <20160629201224.718341351@goodmis.org> <20160630145634.GA2992@krava> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Jun 2016 16:56:34 +0200 Jiri Olsa wrote: > On Wed, Jun 29, 2016 at 04:05:25PM -0400, Steven Rostedt wrote: > > SNIP > > > } > > @@ -2552,11 +2561,18 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) > > } > > > > case FORMAT_TYPE_PTR: { > > + unsigned long *tmp_ptr; > > + unsigned long *ptr; > > const char *_fmt = fmt; > > char tmp_fmt[2]; > > > > if (supported_bin_ptr(fmt)) { > > switch (fmt[0]) { > > + case 'b': { > > + tmp_ptr = get_arg(void *); > > + ptr = (void *)&tmp_ptr; > > this seems wrong.. &tmp_ptr is address from the stack > not from args which is what we want in here IIUC Ah, your right. This only worked because the test I did was on a mask of less than 64 cpus, where the above moved the bitmask into tmp_ptr. I do want the address of the actual args array. > > should we do something like in attached patch? untested.. I'll test it out. Thanks, -- Steve > > thanks, > jirka > > > --- > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > index 474d9ddaca6f..9aeb277ae533 100644 > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -2561,7 +2561,6 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) > } > > case FORMAT_TYPE_PTR: { > - unsigned long *tmp_ptr; > unsigned long *ptr; > const char *_fmt = fmt; > char tmp_fmt[2]; > @@ -2569,8 +2568,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf) > if (supported_bin_ptr(fmt)) { > switch (fmt[0]) { > case 'b': { > - tmp_ptr = get_arg(void *); > - ptr = (void *)&tmp_ptr; > + ptr = (unsigned long *) PTR_ALIGN(args, sizeof(u32)); > + args += BITS_TO_LONGS(spec.field_width); > break; > } > case 'F':