Re: [PATCH v2] fbconsole: check cursor position before moving

2017-02-26 Thread Sascha Hauer
On Fri, Feb 24, 2017 at 02:36:27PM +0100, Bastian Stender wrote:
> Moving the cursor to x=2, y=2 with "\e[3;3H" on a 12x2 framebuffer
> console lead to a barebox crash while drawing the cursor. If the
> cursor position is out of bounds clip the cursor to the corresponding
> edge.
> 
> Signed-off-by: Bastian Stender 
> ---
>  drivers/video/fbconsole.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
> index 64f7d7364e..843a026ff6 100644
> --- a/drivers/video/fbconsole.c
> +++ b/drivers/video/fbconsole.c
> @@ -264,10 +264,13 @@ static void fbc_parse_csi(struct fbc_priv *priv)
>   return;
>   case 'H':
>   video_invertchar(priv, priv->x, priv->y);
> +
>   pos = simple_strtoul(priv->csi, &end, 10);
> - priv->y = pos ? pos - 1 : 0;
> + priv->y = !pos ? 0 : pos < priv->rows ? pos - 1 : priv->rows - 
> 1;
> +
>   pos = simple_strtoul(end + 1, NULL, 10);
> - priv->x = pos ? pos - 1 : 0;
> + priv->x = !pos ? 0 : pos < priv->cols ? pos - 1 : priv->cols - 
> 1;

Not nice to read. Fortunately this situation is common enough so that we
have a function for it:

priv->x = clamp(pos, 0, priv->cols - 1);

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH 07/12] efi: move x86 efi boot support to x86 arch

2017-02-26 Thread Sascha Hauer
On Wed, Feb 15, 2017 at 08:34:15PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
> prepare to drop the efi arch as efi boot up is not arch sepecific
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
> ---
>  Documentation/boards/efi.rst |   2 +-
>  arch/x86/Kconfig |  53 --
>  arch/x86/Makefile|  74 +--
>  arch/x86/configs/efi_defconfig   |  78 
>  arch/x86/configs/generic_defconfig   |   1 +
>  arch/x86/include/asm/elf.h   |  86 +++---
>  arch/x86/include/asm/io.h|  71 +-
>  arch/x86/include/asm/types.h |  51 -
>  arch/x86/include/asm/unaligned.h |   5 ++
>  arch/x86/lib/Makefile|   2 +
>  arch/x86/lib/asm-offsets.c   |   7 ++
>  arch/x86/mach-efi/.gitignore |   2 +
>  arch/x86/mach-efi/Makefile   |   4 +
>  arch/x86/mach-efi/crt0-efi-ia32.S|  76 +++
>  arch/x86/mach-efi/crt0-efi-x86_64.S  |  75 +++
>  arch/x86/mach-efi/elf_ia32_efi.lds.S | 106 
> +++
>  arch/x86/mach-efi/elf_x86_64_efi.lds.S   |  99 +
>  arch/x86/mach-efi/include/mach/barebox.lds.h |   0

This empty file gets removed during make distclean causing build
failures here. I made this file non-empty. With this:

aplied, thanks

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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