From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Grant Likely <grant.likely@secretlab.ca>,
David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vsprintf: Remove SPECIAL from pointer types
Date: Sun, 6 Jul 2014 12:44:40 +0100 (BST) [thread overview]
Message-ID: <alpine.LFD.2.11.1407061222270.15455@eddie.linux-mips.org> (raw)
In-Reply-To: <1404593114.6384.72.camel@joe-AO725>
On Sat, 5 Jul 2014, Joe Perches wrote:
> Because gcc issues a complaint about any pointer format with %#p,
> remove the use of SPECIAL to prefix 0x to various pointer types.
>
> There are no uses in the kernel tree of %#p.
>
> This removes the capability added by commit 725fe002d315
> ("vsprintf: correctly handle width when '#' flag used in %#p format").
>
> There are some incidental message logging output changes of %pa
> uses with this change. None are in seq output so there are no
> api changes.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>
> Fine by me, here...
>
> On Sat, 2014-07-05 at 21:25 +0100, Maciej W. Rozycki wrote:
> > On Sat, 5 Jul 2014, Joe Perches wrote:
> >
> > > > > I don't think %#p is valid so it
> > > > > shouldn't have been set by #.
> > > >
> > > > Huh? As recently as last Wednesday you pointed me at the specific commit
> > > > from Grant that made it valid (GCC format complaints aside).
> > >
> > > Those gcc complaints are precisely the thing
> > > that makes it invalid.
> >
> > So enforce that in code then, clear the SPECIAL flag where appropriate
> > and do not try to handle it in one place while leaving other ones to
> > behave randomly (i.e. a supposedly fixed field width varies depending on
> > the two uppermost digits). Please note that it's only your proposed
> > change that introduces that randomness, right now code does what's
> > supposed and documented to, except a bit inconsistently.
> >
> > > I believe you're tilting at windmills.
> > >
> > > Hey, it works sometimes. Knock yourself out.
> >
> > I pointed out an inconsistency with the intent to propose a fix once a
> > consensus have been reached, one way or another. And I think shifting the
> > inconsistency to a different place, which is what your proposal does,
> > isn't really a complete solution, although I do recognise the improvement.
Conceptually good, thanks for your effort, but you still need to clear
SPECIAL in `pointer' and maybe elsewhere, as that'll have been set for the
case concerned in `format_decode' by this code:
case '#': spec->flags |= SPECIAL; break;
(that doesn't check what follows) and then respected once `number' is
reached. E.g.:
char *pointer(const char *fmt, char *buf, char *end, void *ptr,
struct printf_spec spec)
{
int default_width = 2 * sizeof(void *);
spec.flags &= ~SPECIAL;
or suchlike. Sorry to have been unclear about it.
Note that obviously GCC will only complain about `#' if the format is
constant, there's no way for it to work through a variable format, e.g.:
{
char *f;
void *const p = NULL;
printk("%#p\n", p);
f = kstrdup("%#p\n", GFP_KERNEL);
printk(f, p);
kfree(f);
}
-- it'll complain only about the first `printk', not the second.
Maciej
next prev parent reply other threads:[~2014-07-06 11:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-29 2:10 [PATCH v2] declance: Fix 64-bit compilation warnings Maciej W. Rozycki
2014-07-03 1:28 ` David Miller
2014-07-03 2:29 ` Maciej W. Rozycki
2014-07-03 2:34 ` Maciej W. Rozycki
2014-07-03 3:05 ` Joe Perches
2014-07-03 4:51 ` Maciej W. Rozycki
2014-07-03 5:16 ` Joe Perches
2014-07-03 6:01 ` Maciej W. Rozycki
2014-07-03 6:25 ` Joe Perches
2014-07-03 16:57 ` Grant Likely
2014-07-05 14:56 ` Maciej W. Rozycki
2014-07-05 16:07 ` Joe Perches
2014-07-05 17:39 ` Maciej W. Rozycki
2014-07-05 18:08 ` Joe Perches
2014-07-05 18:20 ` Maciej W. Rozycki
2014-07-05 18:31 ` Joe Perches
2014-07-05 20:25 ` Maciej W. Rozycki
2014-07-05 20:45 ` [PATCH] vsprintf: Remove SPECIAL from pointer types Joe Perches
2014-07-06 11:44 ` Maciej W. Rozycki [this message]
2014-07-06 14:32 ` Joe Perches
2014-07-07 8:26 ` David Laight
2014-07-07 13:26 ` Joe Perches
2014-07-07 12:01 ` [PATCH v2] declance: Fix 64-bit compilation warnings Grant Likely
2014-07-07 12:18 ` Maciej W. Rozycki
2014-07-07 13:40 ` Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.11.1407061222270.15455@eddie.linux-mips.org \
--to=macro@linux-mips.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=grant.likely@secretlab.ca \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).