Re: [Qemu-devel] [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text

2014-06-12 Thread Gonglei (Arei)
> -Original Message- > From: Gerd Hoffmann [mailto:kra...@redhat.com] > Sent: Thursday, June 12, 2014 6:44 PM > To: Gonglei (Arei) > Cc: qemu-devel@nongnu.org; pbonz...@redhat.com; lcapitul...@redhat.com; > av1...@comtv.ru; stefa...@redhat.com; Luonengjun; Huangweidong (C) > Subject: Re: [P

Re: [Qemu-devel] [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text

2014-06-12 Thread Paolo Bonzini
Il 12/06/2014 12:43, Gerd Hoffmann ha scritto: 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. I have no idea why Coverity thinks width

Re: [Qemu-devel] [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text

2014-06-12 Thread Gerd Hoffmann
Hi, > 2097if (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_off

[Qemu-devel] [PATCH v3 4/4] vga: Fix divide-by-zero in vga_update_text

2014-06-10 Thread arei.gonglei
From: Gonglei Spotted by Coverity: (20) Event cond_true: Condition "cursor_visible", taking true branch (21) Event cond_true: Condition "cursor_offset < size", taking true branch (22) Event cond_true: Condition "cursor_offset >= 0", taking true branch 2097if (cursor_visible && cursor_off