lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 15 Feb 2024 11:40:44 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Andy Shevchenko <andy@...nel.org>, Rob Herring <robh+dt@...nel.org>, 
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor+dt@...nel.org>, 
	Robin van der Gracht <robin@...tonic.nl>, Paul Burton <paulburton@...nel.org>
Subject: Re: [PATCH v2 10/15] auxdisplay: linedisp: Provide a small buffer in
 the struct linedisp

Hi Andy,

On Mon, Feb 12, 2024 at 6:04 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> There is a driver that uses small buffer for the string, when we
> add a new one, we may avoid duplication and use one provided by
> the line display library. Allow user to skip buffer pointer when
> registering a device.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Thanks for your patch!

> --- a/drivers/auxdisplay/line-display.c
> +++ b/drivers/auxdisplay/line-display.c
> @@ -330,8 +330,8 @@ int linedisp_register(struct linedisp *linedisp, struct device *parent,
>         linedisp->dev.parent = parent;
>         linedisp->dev.type = &linedisp_type;
>         linedisp->ops = ops;
> -       linedisp->buf = buf;
> -       linedisp->num_chars = num_chars;
> +       linedisp->buf = buf ? buf : linedisp->curr;
> +       linedisp->num_chars = buf ? num_chars : min(num_chars, LINEDISP_DEFAULT_BUF_SZ);

I think it would be safer to return an error if buf == NULL and
num_chars < LINEDISP_DEFAULT_BUF_SZ.
Else a careless driver that doesn't check linedisp->num_chars might
overflow the buffer.

>         linedisp->scroll_rate = DEFAULT_SCROLL_RATE;
>
>         err = ida_alloc(&linedisp_id, GFP_KERNEL);

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68korg

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ