From: Paolo Bonzini Subject: [PATCH kvm-unit-tests 17/18] arm: do not allocate virtio buffers from the stack Date: Tue, 24 Oct 2017 17:21:44 +0200 Message-ID: <20171024152145.28456-18-pbonzini@redhat.com> References: <20171024152145.28456-1-pbonzini@redhat.com> Cc: drjones@redhat.com, david@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:56892 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932457AbdJXPWO (ORCPT ); Tue, 24 Oct 2017 11:22:14 -0400 Received: by mail-wm0-f68.google.com with SMTP id z3so10106064wme.5 for ; Tue, 24 Oct 2017 08:22:13 -0700 (PDT) In-Reply-To: <20171024152145.28456-1-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: The stack will be in virtual memory space starting from the next patch, so the address of automatic variables will not be a physical address anymore. Signed-off-by: Paolo Bonzini --- lib/chr-testdev.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c index c19424f..ca4a10b 100644 --- a/lib/chr-testdev.c +++ b/lib/chr-testdev.c @@ -30,20 +30,19 @@ static void __testdev_send(char *buf, unsigned int len) void chr_testdev_exit(int code) { unsigned int len; - char buf[8]; - - snprintf(buf, sizeof(buf), "%dq", code); - len = strlen(buf); + static char buf[8]; spin_lock(&lock); - if (!vcon) - goto out; + snprintf(buf, sizeof(buf), "%dq", code); + len = strlen(buf); - __testdev_send(buf, len); + if (vcon) { + __testdev_send(buf, len); + printf("this shouldn't have happened!"); + } -out: - spin_unlock(&lock); + while (1); } void chr_testdev_init(void) -- 2.14.2