* [Qemu-devel] [PATCH] memsave: Add a space after address in error message
@ 2015-02-07 20:29 Borislav Petkov
2015-02-08 10:09 ` Paolo Bonzini
0 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2015-02-07 20:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Anthony Liguori
From: Borislav Petkov <bp@suse.de>
Add the missing space to separate address from "specified".
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
cpus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 0cdd1d71560b..4fa196d48207 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1489,7 +1489,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
if (l > size)
l = size;
if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
- error_setg(errp, "Invalid addr 0x%016" PRIx64 "specified", addr);
+ error_setg(errp, "Invalid addr 0x%016" PRIx64 " specified", addr);
goto exit;
}
if (fwrite(buf, 1, l, f) != l) {
--
2.2.0.33.gc18b867
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] memsave: Add a space after address in error message
2015-02-07 20:29 [Qemu-devel] [PATCH] memsave: Add a space after address in error message Borislav Petkov
@ 2015-02-08 10:09 ` Paolo Bonzini
2015-02-08 12:14 ` [Qemu-devel] [PATCH] memsave: Improve and disambiguate " Borislav Petkov
0 siblings, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2015-02-08 10:09 UTC (permalink / raw)
To: Borislav Petkov, qemu-devel; +Cc: qemu-trivial@nongnu.org, Anthony Liguori
Cc: qemu-trivial@nongnu.org
On 07/02/2015 21:29, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Add the missing space to separate address from "specified".
>
> Cc: Anthony Liguori <aliguori@amazon.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
> cpus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 0cdd1d71560b..4fa196d48207 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1489,7 +1489,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
> if (l > size)
> l = size;
> if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
> - error_setg(errp, "Invalid addr 0x%016" PRIx64 "specified", addr);
> + error_setg(errp, "Invalid addr 0x%016" PRIx64 " specified", addr);
> goto exit;
> }
> if (fwrite(buf, 1, l, f) != l) {
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] memsave: Improve and disambiguate error message
2015-02-08 10:09 ` Paolo Bonzini
@ 2015-02-08 12:14 ` Borislav Petkov
2015-02-08 21:46 ` Paolo Bonzini
2015-02-10 19:06 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
0 siblings, 2 replies; 6+ messages in thread
From: Borislav Petkov @ 2015-02-08 12:14 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-trivial@nongnu.org, qemu-devel, Anthony Liguori
On Sun, Feb 08, 2015 at 11:09:24AM +0100, Paolo Bonzini wrote:
> Cc: qemu-trivial@nongnu.org
Thanks.
But, there's more b0rked with this error message so you might wanna take
the patch below instead.
Btw, what are the vim settings when doing patches for qemu, this must be
documented somewhere as coding style differs significantly from that of
the kernel?
:-)
---
From: Borislav Petkov <bp@suse.de>
Subject: [PATCH] memsave: Improve and disambiguate error message
When requesting a size which cannot be read, the error message shows
a different address which is misleading to the user and it looks like
something's wrong with the address parsing. This is because the input
@addr variable is incremented in the memory dumping loop:
(qemu) memsave 0xffffffff8418069c 0xb00000 mem
Invalid addr 0xffffffff849ffe9c specified
Fix that by saving the original address and size and use them in the
error message:
(qemu) memsave 0xffffffff8418069c 0xb00000 mem
Invalid addr 0xffffffff8418069c/size 11534336 specified
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
---
cpus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cpus.c b/cpus.c
index 0cdd1d71560b..a5c7cad00fc9 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1466,6 +1466,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
uint32_t l;
CPUState *cpu;
uint8_t buf[1024];
+ int64_t orig_addr = addr, orig_size = size;
if (!has_cpu) {
cpu_index = 0;
@@ -1489,7 +1490,8 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
if (l > size)
l = size;
if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
- error_setg(errp, "Invalid addr 0x%016" PRIx64 "specified", addr);
+ error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64
+ " specified", orig_addr, orig_size);
goto exit;
}
if (fwrite(buf, 1, l, f) != l) {
--
2.2.0.33.gc18b867
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] memsave: Improve and disambiguate error message
2015-02-08 12:14 ` [Qemu-devel] [PATCH] memsave: Improve and disambiguate " Borislav Petkov
@ 2015-02-08 21:46 ` Paolo Bonzini
2015-02-10 9:22 ` Borislav Petkov
2015-02-10 19:06 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
1 sibling, 1 reply; 6+ messages in thread
From: Paolo Bonzini @ 2015-02-08 21:46 UTC (permalink / raw)
To: Borislav Petkov; +Cc: qemu-trivial@nongnu.org, qemu-devel, Anthony Liguori
On 08/02/2015 13:14, Borislav Petkov wrote:
> On Sun, Feb 08, 2015 at 11:09:24AM +0100, Paolo Bonzini wrote:
>> Cc: qemu-trivial@nongnu.org
>
> Thanks.
>
> But, there's more b0rked with this error message so you might wanna take
> the patch below instead.
>
> Btw, what are the vim settings when doing patches for qemu, this must be
> documented somewhere as coding style differs significantly from that of
> the kernel?
I use ":set shiftwidth=4 expandtab" and c-indent mode.
Quick googling for "vim four spaces" suggests the following alternatives:
* ":set tabstop=8 expandtab shiftwidth=4 softtabstop=4"
* "set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab".
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] memsave: Improve and disambiguate error message
2015-02-08 21:46 ` Paolo Bonzini
@ 2015-02-10 9:22 ` Borislav Petkov
0 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2015-02-10 9:22 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-trivial@nongnu.org, qemu-devel, Anthony Liguori
On Sun, Feb 08, 2015 at 10:46:05PM +0100, Paolo Bonzini wrote:
> I use ":set shiftwidth=4 expandtab" and c-indent mode.
>
> Quick googling for "vim four spaces" suggests the following alternatives:
>
> * ":set tabstop=8 expandtab shiftwidth=4 softtabstop=4"
>
> * "set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab".
Thanks Paolo!
:-)
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] memsave: Improve and disambiguate error message
2015-02-08 12:14 ` [Qemu-devel] [PATCH] memsave: Improve and disambiguate " Borislav Petkov
2015-02-08 21:46 ` Paolo Bonzini
@ 2015-02-10 19:06 ` Michael Tokarev
1 sibling, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2015-02-10 19:06 UTC (permalink / raw)
To: Borislav Petkov, Paolo Bonzini
Cc: qemu-trivial@nongnu.org, qemu-devel, Anthony Liguori
08.02.2015 15:14, Borislav Petkov wrote:
> On Sun, Feb 08, 2015 at 11:09:24AM +0100, Paolo Bonzini wrote:
>> Cc: qemu-trivial@nongnu.org
>
> Thanks.
>
> But, there's more b0rked with this error message so you might wanna take
> the patch below instead.
>
> Btw, what are the vim settings when doing patches for qemu, this must be
> documented somewhere as coding style differs significantly from that of
> the kernel?
>
> :-)
>
> ---
> From: Borislav Petkov <bp@suse.de>
> Subject: [PATCH] memsave: Improve and disambiguate error message
>
> When requesting a size which cannot be read, the error message shows
> a different address which is misleading to the user and it looks like
> something's wrong with the address parsing. This is because the input
> @addr variable is incremented in the memory dumping loop:
Applied this version to -trivial, thank you!
/mjt
> (qemu) memsave 0xffffffff8418069c 0xb00000 mem
> Invalid addr 0xffffffff849ffe9c specified
>
> Fix that by saving the original address and size and use them in the
> error message:
>
> (qemu) memsave 0xffffffff8418069c 0xb00000 mem
> Invalid addr 0xffffffff8418069c/size 11534336 specified
>
> Cc: Anthony Liguori <aliguori@amazon.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> ---
> cpus.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 0cdd1d71560b..a5c7cad00fc9 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1466,6 +1466,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
> uint32_t l;
> CPUState *cpu;
> uint8_t buf[1024];
> + int64_t orig_addr = addr, orig_size = size;
>
> if (!has_cpu) {
> cpu_index = 0;
> @@ -1489,7 +1490,8 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
> if (l > size)
> l = size;
> if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
> - error_setg(errp, "Invalid addr 0x%016" PRIx64 "specified", addr);
> + error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRId64
> + " specified", orig_addr, orig_size);
> goto exit;
> }
> if (fwrite(buf, 1, l, f) != l) {
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-02-10 19:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-07 20:29 [Qemu-devel] [PATCH] memsave: Add a space after address in error message Borislav Petkov
2015-02-08 10:09 ` Paolo Bonzini
2015-02-08 12:14 ` [Qemu-devel] [PATCH] memsave: Improve and disambiguate " Borislav Petkov
2015-02-08 21:46 ` Paolo Bonzini
2015-02-10 9:22 ` Borislav Petkov
2015-02-10 19:06 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
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).