All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com,
	qemu-devel@nongnu.org, jjherne@linux.vnet.ibm.com, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH v3 4/8] s390x: Dump storage keys qmp command
Date: Mon, 31 Aug 2015 17:20:08 +0200	[thread overview]
Message-ID: <20150831172008.0a695bb2.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <55E46923.4030304@redhat.com>

On Mon, 31 Aug 2015 08:48:03 -0600
Eric Blake <eblake@redhat.com> wrote:

> On 08/31/2015 05:00 AM, Cornelia Huck wrote:
> > From: "Jason J. Herne" <jjherne@linux.vnet.ibm.com>
> > 
> > Provide a dump-skeys qmp command to allow the end user to dump storage
> > keys. This is useful for debugging problems with guest storage key support
> > within Qemu and for guest operating system developers.
> > 
> > Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> > Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > ---
> >  hw/s390x/s390-skeys.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++--
> >  monitor.c             |  7 ++++
> >  qapi-schema.json      | 14 ++++++++
> >  qmp-commands.hx       | 25 ++++++++++++++
> >  4 files changed, 134 insertions(+), 2 deletions(-)
> > 
> 
> > +static void write_keys(QEMUFile *f, uint8_t *keys, uint64_t startgfn,
> > +                       uint64_t count, Error **errp)
> > +{
> > +    uint64_t curpage = startgfn;
> > +    uint64_t maxpage = curpage + count - 1;
> > +    const char *fmt = "page=%03" PRIx64 ": key(%d) => ACC=%X, FP=%d, REF=%d,"
> > +                      " ch=%d, reserved=%d\n";
> > +    char buf[128];
> > +    int len;
> > +
> > +    for (; curpage <= maxpage; curpage++) {
> > +        uint8_t acc = (*keys & 0xF0) >> 4;
> > +        int fp =  (*keys & 0x08);
> > +        int ref = (*keys & 0x04);
> > +        int ch = (*keys & 0x02);
> > +        int res = (*keys & 0x01);
> > +
> > +        len = snprintf(buf, sizeof(buf), fmt, curpage,
> > +                       *keys, acc, fp, ref, ch, res);
> > +        qemu_put_buffer(f, (uint8_t *)buf, len);
> 
> While I can overlook the use of snprintf(), I still think you ought to
> at least have assert(len < sizeof(buf)) here before the
> qemu_put_buffer(), to ensure that future changes to fmt don't attempt to
> print beyond the end of the fixed-width buffer.

I'll just merge that in when sending the pull request.

> 
> With an assert added,
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
Thanks!

  reply	other threads:[~2015-08-31 15:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 11:00 [Qemu-devel] [PATCH v3 0/8] s390x: storage key migration Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 1/8] s390x: add 2.5 compat s390-ccw-virtio machine Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 2/8] s390x: Create QOM device for s390 storage keys Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 3/8] s390x: Enable new s390-storage-keys device Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 4/8] s390x: Dump storage keys qmp command Cornelia Huck
2015-08-31 14:48   ` Eric Blake
2015-08-31 15:20     ` Cornelia Huck [this message]
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 5/8] s390x: Dump-skeys hmp support Cornelia Huck
2015-08-31 16:30   ` Eric Blake
2015-08-31 18:57     ` Jason J. Herne
2015-09-01 14:30       ` Cornelia Huck
2015-09-01 16:05         ` Eric Blake
2015-09-01 16:22           ` Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 6/8] s390x: Info skeys sub-command Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 7/8] s390x: Migrate guest storage keys (initial memory only) Cornelia Huck
2015-08-31 11:00 ` [Qemu-devel] [PATCH v3 8/8] s390x: Disable storage key migration on old machine type Cornelia Huck

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=20150831172008.0a695bb2.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=eblake@redhat.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.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.