From: Joe Perches <joe@perches.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: William Hubbs <w.d.hubbs@gmail.com>,
Chris Brannon <chris@the-brannons.com>,
Kirk Reiser <kirk@reisers.ca>,
Samuel Thibault <samuel.thibault@ens-lyon.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, speakup@linux-speakup.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: speakup: kobjects.c: fix char argument to %02x
Date: Sat, 05 Dec 2015 16:28:29 -0800 [thread overview]
Message-ID: <1449361709.20344.9.camel@perches.com> (raw)
In-Reply-To: <874mfwqved.fsf@rasmusvillemoes.dk>
On Sun, 2015-12-06 at 01:21 +0100, Rasmus Villemoes wrote:
> On Sun, Dec 06 2015, Joe Perches <joe@perches.com> wrote:
>
> > On Sun, 2015-12-06 at 01:05 +0100, Rasmus Villemoes wrote:
> > > If char is signed and ch happens to be negative, printing ch with
> > > "%02x" will not do as intended (when ch is -19, one will get
> > > "ffffffed"). Fix that by masking with 0xff.
> >
> > I presume there are a lot of these in the kernel.
> > Did you use a tool to find this or just inspection?
>
> Initially I just used coccinelle, for the most obvious candidates
> (with
> --include-headers-for-types):
>
> @r depends on !patch@
> char c;
> @@
> * \( sprintf \| snprintf \| scnprintf \) (..., c, ...)
>
> That gives lots of false positives (arguments to %c), but it's not
> too
> bad piping to less, searching for "%[0.]2[xX]", and then checking
> manually.
>
> I'm now doing a much wider range of printf functions, but it's really
> past my bedtime, so feel free to pick up the ball :-)
>
Thanks, but no thanks. It's your ball. Enjoy...
You might consider looking for s8 and s16 emitted as %u too.
next prev parent reply other threads:[~2015-12-06 0:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-06 0:05 [PATCH] staging: speakup: kobjects.c: fix char argument to %02x Rasmus Villemoes
2015-12-06 0:12 ` Joe Perches
2015-12-06 0:21 ` Rasmus Villemoes
2015-12-06 0:28 ` Joe Perches [this message]
2015-12-12 23:49 ` Andy Shevchenko
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=1449361709.20344.9.camel@perches.com \
--to=joe@perches.com \
--cc=chris@the-brannons.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kirk@reisers.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=samuel.thibault@ens-lyon.org \
--cc=speakup@linux-speakup.org \
--cc=w.d.hubbs@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.