All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	ian.campbell@citrix.com, ian.jackson@eu.citrix.com,
	jbeulich@suse.com, keir@xen.org, tim@xen.org
Cc: xen-devel@lists.xen.org
Subject: Re: [PATCH v2] vsprintf: Make sure argument to %pX specifier is valid
Date: Thu, 12 Feb 2015 11:41:38 -0500	[thread overview]
Message-ID: <54DCD7C2.8040902@oracle.com> (raw)
In-Reply-To: <54DCD5C6.603@oracle.com>

On 02/12/2015 11:33 AM, Boris Ostrovsky wrote:
>
>
> Also, for %*ph format, if we just go with falling through to plain 
> format and not marking somehow that we are printing a bad pointer:
>
>     unsigned badval = 0xab;
>     unsigned *badptr = &badval;
>     printk("badptr = %*ph\n", 1, badptr);
>
> console:
>     badptr = ab
>
> We don't know here whether badptr was pointing to 0xab or it itself 
> was 0xab.
>

Ugh, bad example. Here is what I meant:

     unsigned badval = 0xab;
     unsigned *badptr = &badval;
     unsigned *badvalptr = (void *)0xab;
     printk("badvalptr = %*ph badptr = %*ph\n", 1, badvalptr, 1, badptr);

console:
     badvalptr = ab badptr = ab


Sorry.

-boris

  reply	other threads:[~2015-02-12 16:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 20:58 [PATCH v2] vsprintf: Make sure argument to %pX specifier is valid Boris Ostrovsky
2015-02-12 11:04 ` Andrew Cooper
2015-02-12 15:01   ` Boris Ostrovsky
2015-02-12 15:21     ` Andrew Cooper
2015-02-12 15:38       ` Boris Ostrovsky
2015-02-12 15:48         ` Andrew Cooper
2015-02-12 16:33           ` Boris Ostrovsky
2015-02-12 16:41             ` Boris Ostrovsky [this message]
2015-02-12 16:50             ` Andrew Cooper

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=54DCD7C2.8040902@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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 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.