All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PULL 5/7] hw: convert the escc device to keycodemapdb
Date: Thu, 31 Mar 2022 11:03:49 +0100	[thread overview]
Message-ID: <CAFEAcA_rDF-6=-S--F-NU_Q-YaZSKw1f6GvKekayuYviQv0ebA@mail.gmail.com> (raw)
In-Reply-To: <20180129102320.21534-6-kraxel@redhat.com>

On Mon, 29 Jan 2018 at 10:24, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> From: "Daniel P. Berrange" <berrange@redhat.com>
>
> Replace the qcode_to_keycode table with automatically
> generated tables.
>
> Missing entries in qcode_to_keycode now fixed:
>
>  - Q_KEY_CODE_KP_COMMA -> 0x2d
>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> Message-id: 20180117164118.8510-3-berrange@redhat.com
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

> @@ -879,7 +759,11 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
>          }
>      }
>
> -    keycode = qcode_to_keycode[qcode];
> +    if (qcode > qemu_input_map_qcode_to_sun_len) {
> +        return;
> +    }
> +
> +    keycode = qemu_input_map_qcode_to_sun[qcode];
>      if (!key->down) {
>          keycode |= 0x80;
>      }

Hi; I was looking at this code because Coverity is now clever enough
to try to check whether the qemu_input_map_qcode_to_sun[] array
is being overrun (though alas not clever enough to spot that
qemu_input_map_qcode_to_sun_len is the length of that array,
so there are false positive complaints about all the uses of these
autogenerated arrays in all devices that use them).

In this specific case, though, it does look like there's a bug:
shouldn't the condition be "if (qcode >= qemu_input_map_qcode_to_sun_len)" ?

thanks
-- PMM


  reply	other threads:[~2022-03-31 10:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-29 10:23 [Qemu-devel] [PULL 0/7] Input 20180129 v2 patches Gerd Hoffmann
2018-01-29 10:23 ` [Qemu-devel] [PULL 1/7] input: add mouse side buttons to virtio input Gerd Hoffmann
2018-01-29 10:23 ` [Qemu-devel] [PULL 2/7] input: virtio: don't send mouse wheel event twice Gerd Hoffmann
2018-01-29 10:23 ` [Qemu-devel] [PULL 3/7] ps2: check PS2Queue pointers in post_load routine Gerd Hoffmann
2018-01-29 10:23 ` [Qemu-devel] [PULL 4/7] hw: convert ps2 device to keycodemapdb Gerd Hoffmann
2018-01-29 10:23 ` [Qemu-devel] [PULL 5/7] hw: convert the escc " Gerd Hoffmann
2022-03-31 10:03   ` Peter Maydell [this message]
2022-03-31 10:10     ` Daniel P. Berrangé
2018-01-29 10:23 ` [Qemu-devel] [PULL 6/7] ui: fix alphabetical ordering of keymaps Gerd Hoffmann
2018-01-29 10:23 ` [Qemu-devel] [PULL 7/7] hw: convert virtio-input-hid device to keycodemapdb Gerd Hoffmann
2018-01-29 17:17 ` [Qemu-devel] [PULL 0/7] Input 20180129 v2 patches Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2018-01-26  9:13 [Qemu-devel] [PULL 0/7] Input 20180126 patches Gerd Hoffmann
2018-01-26  9:13 ` [Qemu-devel] [PULL 5/7] hw: convert the escc device to keycodemapdb Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFEAcA_rDF-6=-S--F-NU_Q-YaZSKw1f6GvKekayuYviQv0ebA@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.