[PATCH 16/25] efi-stdio: limit set_cursor to screen size boundaries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



set_cursor_position() may only be called with values actually inside the
screen. Limit the values accordingly.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/serial/efi-stdio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index dacdb74934..0ba8d3f6c0 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -244,8 +244,11 @@ static int efi_process_square_bracket(struct efi_console_priv *priv, const char
 		}
 		break;
 	case 'H':
-		if (arg0 >= 0 && arg1 >= 0)
-			priv->out->set_cursor_position(priv->out, arg1 - 1, arg0 - 1);
+		if (arg0 >= 0 && arg1 >= 0) {
+			int row = min_t(int, arg0, priv->rows);
+			int col = min_t(int, arg1, priv->columns);
+			priv->out->set_cursor_position(priv->out, col - 1, row - 1);
+		}
 		break;
 	case 'm':
 		switch (arg0) {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux