From: Thomas Huth <thuth@redhat.com>
To: Halil Pasic <pasic@linux.ibm.com>,
Cornelia Huck <cohuck@redhat.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Cc: Claudio Imbrenda <imbrenda@linux.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
David Hildenbrand <david@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 1/1] s390x/s390-virtio-ccw: fix loadparm property getter
Date: Thu, 23 Jul 2020 18:37:50 +0200 [thread overview]
Message-ID: <0ce16e30-a5ea-f9ff-89a8-83c393b5118c@redhat.com> (raw)
In-Reply-To: <20200723162717.88485-1-pasic@linux.ibm.com>
On 23/07/2020 18.27, Halil Pasic wrote:
> The function machine_get_loadparm() is supposed to produce as C-string,
sed "s/ as / a /"
> that is a null-terminated one, but it does not. ElectricFence can detect
maybe: sed "s/null/NUL/"
> this problem if the loadparm machine property is used.
>
> Let us make the returned string a null-terminated one.
dito
> Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
> Fixes: 7104bae9de ("hw/s390x: provide loadparm property for the machine")
> ---
> hw/s390x/s390-virtio-ccw.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 8cc2f25d8a..e0e4a69ac8 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -701,8 +701,12 @@ bool hpage_1m_allowed(void)
> static char *machine_get_loadparm(Object *obj, Error **errp)
> {
> S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
> + char *loadparm_str;
>
> - return g_memdup(ms->loadparm, sizeof(ms->loadparm));
> + /* make a null-terminated string */
maybe: sed "s/null/NUL/"
> + loadparm_str = g_memdup(ms->loadparm, sizeof(ms->loadparm) + 1);
Wrong indentation.
> + loadparm_str[sizeof(ms->loadparm)] = 0;
> + return loadparm_str;
> }
With the cosmetics fixed:
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2020-07-23 16:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 16:27 [PATCH 1/1] s390x/s390-virtio-ccw: fix loadparm property getter Halil Pasic
2020-07-23 16:37 ` Thomas Huth [this message]
2020-07-24 6:52 ` Cornelia Huck
2020-07-27 10:22 ` Halil Pasic
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=0ce16e30-a5ea-f9ff-89a8-83c393b5118c@redhat.com \
--to=thuth@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=imbrenda@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=rth@twiddle.net \
/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).