summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Thibault2017-12-11 01:19:50 +0100
committerPaolo Bonzini2017-12-21 09:22:44 +0100
commit1ef7c96ee2133753f4aa48617ddbef10d5a88fc9 (patch)
treed8bba60203a5a0f8989e6a768891fea9b864f5f7
parenttarget/i386: Fix compiler warnings (diff)
downloadqemu-1ef7c96ee2133753f4aa48617ddbef10d5a88fc9.tar.gz
qemu-1ef7c96ee2133753f4aa48617ddbef10d5a88fc9.tar.xz
qemu-1ef7c96ee2133753f4aa48617ddbef10d5a88fc9.zip
baum: Truncate braille device size to 84x1
Baum device bigger than 84 do not actually exist, but the user's own Braille device might be wider than 84 columns. Some guest drivers would be upset by such sizes, so clamp the device size. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Message-Id: <20171211001950.27843-1-samuel.thibault@ens-lyon.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--chardev/baum.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/chardev/baum.c b/chardev/baum.c
index 67fd783a59..78b0c87625 100644
--- a/chardev/baum.c
+++ b/chardev/baum.c
@@ -1,7 +1,7 @@
/*
* QEMU Baum Braille Device
*
- * Copyright (c) 2008, 2010-2011, 2016 Samuel Thibault
+ * Copyright (c) 2008, 2010-2011, 2016-2017 Samuel Thibault
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -239,6 +239,12 @@ static int baum_deferred_init(BaumChardev *baum)
brlapi_perror("baum: brlapi__getDisplaySize");
return 0;
}
+ if (baum->y > 1) {
+ baum->y = 1;
+ }
+ if (baum->x > 84) {
+ baum->x = 84;
+ }
con = qemu_console_lookup_by_index(0);
if (con && qemu_console_is_graphic(con)) {