qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
	Gerd Hoffmann <kraxel@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:10:04 +0100	[thread overview]
Message-ID: <YkV9/OLeaOmKrXzR@redhat.com> (raw)
In-Reply-To: <CAFEAcA_rDF-6=-S--F-NU_Q-YaZSKw1f6GvKekayuYviQv0ebA@mail.gmail.com>

On Thu, Mar 31, 2022 at 11:03:49AM +0100, Peter Maydell wrote:
> 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)" ?

Yes, you are right.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2022-03-31 10:14 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
2022-03-31 10:10     ` Daniel P. Berrangé [this message]
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=YkV9/OLeaOmKrXzR@redhat.com \
    --to=berrange@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=peter.maydell@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).