From 75c47ae9b63483ac404ea7e4a28cb5fb1d989ef8 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 19 Jan 2018 11:09:55 +0100 Subject: [PATCH] x86/HVM: make explicit that hvm_print_line() does output only 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 Reviewed-by: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index db282b55d9..cee2385a60 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -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') ) -- 2.30.2