[PATCH libevdev 1/2] Avoid under-allocation of array for syncing key/led state

David Herrmann dh.herrmann at gmail.com
Tue Aug 27 03:09:51 PDT 2013


Hi

On Tue, Aug 27, 2013 at 12:12 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> No functional effect as the size would end up being the same anyway
> due to the values of KEY_MAX and LED_MAX.
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

Yepp, looks good.
Reviewed-by: David Herrmann <dh.herrmann at gmail.com>

> ---
>  libevdev/libevdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> index 76a47a8..b692590 100644
> --- a/libevdev/libevdev.c
> +++ b/libevdev/libevdev.c
> @@ -302,7 +302,7 @@ sync_key_state(struct libevdev *dev)
>  {
>         int rc;
>         int i;
> -       unsigned long keystate[NLONGS(KEY_MAX)];
> +       unsigned long keystate[NLONGS(KEY_CNT)];
>
>         rc = ioctl(dev->fd, EVIOCGKEY(sizeof(keystate)), keystate);
>         if (rc < 0)
> @@ -329,7 +329,7 @@ sync_led_state(struct libevdev *dev)
>  {
>         int rc;
>         int i;
> -       unsigned long ledstate[NLONGS(LED_MAX)];
> +       unsigned long ledstate[NLONGS(LED_CNT)];
>
>         rc = ioctl(dev->fd, EVIOCGLED(sizeof(ledstate)), ledstate);
>         if (rc < 0)
> --
> 1.8.2.1
>
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list