All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gonglei (Arei)" <arei.gonglei@huawei.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Huangweidong (C)" <weidong.huang@huawei.com>,
	Luonengjun <luonengjun@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"lcapitulino@redhat.com" <lcapitulino@redhat.com>,
	"av1474@comtv.ru" <av1474@comtv.ru>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text
Date: Thu, 12 Jun 2014 12:58:15 +0000	[thread overview]
Message-ID: <33183CC9F5247A488A2544077AF1902086C07C5C@SZXEMA503-MBS.china.huawei.com> (raw)
In-Reply-To: <1402569830.21444.5.camel@nilsson.home.kraxel.org>

> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Thursday, June 12, 2014 6:44 PM
> To: Gonglei (Arei)
> Cc: qemu-devel@nongnu.org; pbonzini@redhat.com; lcapitulino@redhat.com;
> av1474@comtv.ru; stefanha@redhat.com; Luonengjun; Huangweidong (C)
> Subject: Re: [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text
> 
>   Hi,
> 
> > 2097    if (cursor_visible && cursor_offset < size && cursor_offset >= 0)
> > (23) Event divide_by_zero:  In expression "cursor_offset / width",
> > division by expression "width" which may be zero has undefined behavior.
> 
> > -            if (cursor_visible && cursor_offset < size && cursor_offset >=
> 0)
> > +            if (cursor_visible && cursor_offset < size && cursor_offset >
> 0)
> >                  dpy_text_cursor(s->con,
> >                                  TEXTMODE_X(cursor_offset),
> >                                  TEXTMODE_Y(cursor_offset));
> 
> That doesn't fix the reported issue.  It's "width" which Coverity thinks
> might be zero, not cursor_offset.  And cursor_offset being zero is
> perfectly fine, happens when the cursor is in the upper left corner.
> 
Yep, I'm sorry for this fault.

> I have no idea why Coverity thinks width can be zero there.  Line 2047:
> 
>         width = (s->cr[VGA_CRTC_H_DISP] + 1);
> 
> (where cr is uint8_t).  Hmm, maybe for the wraparound case (i.e.
> s->cr[VGA_CRTC_H_DISP] == 0xff)?
> 
> cheers,
>   Gerd
> 

Best regards,
-Gonglei

      parent reply	other threads:[~2014-06-12 12:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10  9:20 [Qemu-devel] [PATCH v3 0/4] Fix some errors spotted by Coverity arei.gonglei
2014-06-10  9:20 ` [Qemu-devel] [PATCH v3 1/4] json-parser: drop superfluous assignment for token variable arei.gonglei
2014-06-10 12:35   ` Eric Blake
2014-06-10 14:57   ` Luiz Capitulino
2014-06-10  9:20 ` [Qemu-devel] [PATCH v3 2/4] qemu-bridge-helper: Fix fd leak in main() arei.gonglei
2014-06-11 11:31   ` Stefan Hajnoczi
2014-06-10  9:20 ` [Qemu-devel] [PATCH v3 3/4] audio: Fix using freed pointer in wav_fini_out() arei.gonglei
2014-06-10 10:05   ` Peter Maydell
2014-06-12 10:31     ` Gerd Hoffmann
2014-06-12 13:05       ` Gonglei (Arei)
2014-06-12 13:38         ` Gerd Hoffmann
2014-06-10  9:20 ` [Qemu-devel] [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text arei.gonglei
2014-06-12 10:43   ` Gerd Hoffmann
2014-06-12 11:07     ` Paolo Bonzini
2014-06-12 12:58     ` Gonglei (Arei) [this message]

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=33183CC9F5247A488A2544077AF1902086C07C5C@SZXEMA503-MBS.china.huawei.com \
    --to=arei.gonglei@huawei.com \
    --cc=av1474@comtv.ru \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.com \
    /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.