]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86/HVM: make explicit that hvm_print_line() does output only
authorJan Beulich <jbeulich@suse.com>
Fri, 19 Jan 2018 10:09:55 +0000 (11:09 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 19 Jan 2018 10:09:55 +0000 (11:09 +0100)
On input "c" being 0xff should already have the effect of bailing early
(due to the isprint()), but let's rather make this explicit. Also
convert the BUG_ON() to an ASSERT() (nothing fatal happens in the
function if this is violated), at the same time extending what is being
checked.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/hvm.c

index db282b55d94aa2fd8836ff341dbd61102c17185c..cee2385a60590fab74c4816b5afe768fbb260766 100644 (file)
@@ -544,7 +544,11 @@ static int hvm_print_line(
     struct domain *cd = current->domain;
     char c = *val;
 
-    BUG_ON(bytes != 1);
+    ASSERT(bytes == 1 && port == 0xe9);
+
+    /* Deny any input requests. */
+    if ( dir != IOREQ_WRITE )
+        return X86EMUL_UNHANDLEABLE;
 
     /* Accept only printable characters, newline, and horizontal tab. */
     if ( !isprint(c) && (c != '\n') && (c != '\t') )