Bug 732754 - Coverity scan revealed defects
Summary: Coverity scan revealed defects
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: xorg-x11-drv-intel
Version: 6.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Adam Jackson
QA Contact: desktop-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-23 13:54 UTC by Michal Luscon
Modified: 2011-09-26 20:26 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-26 18:50:02 UTC


Attachments (Terms of Use)

Description Michal Luscon 2011-08-23 13:54:00 UTC
Description of problem:

/intel-gpu-tools-20110628/tests/gem_stress_gen6.c:506 - This greater-than-or-equal-to-zero comparison of an unsigned value is always true.

/intel-gpu-tools-20110628/tests/gem_stress.c:503 - Dereferencing "tiling" (line #502) before a null check.

/xf86-video-intel-2.16.0/src/i965_render.c:1240 - Overrunning static array "i965_tex_formats", with 13 elements, at position 13 with index variable "i".

/xf86-video-intel-2.16.0/src/intel_dri.c:885 - Dereferencing "drawable" (line #877) before a null check.


Version-Release number of selected component (if applicable):
xorg-x11-drv-intel-2.16.0-1.el6

Additional info:
These defects were not present in the previous version of package.

Comment 2 Adam Jackson 2011-09-26 18:50:02 UTC
(In reply to comment #0)
> Description of problem:
> 
> /intel-gpu-tools-20110628/tests/gem_stress_gen6.c:506 - This
> greater-than-or-equal-to-zero comparison of an unsigned value is always true.

Yeah, that's macro abuse for you.  Learn about assert() please.

> /intel-gpu-tools-20110628/tests/gem_stress.c:503 - Dereferencing "tiling" (line
> #502) before a null check.

Technically true but harmless, tiling argument is always &foo in the callers.

> /xf86-video-intel-2.16.0/src/i965_render.c:1240 - Overrunning static array
> "i965_tex_formats", with 13 elements, at position 13 with index variable "i".

Coverity bug, this path is guarded by an assert() which makes that value a can't-happen.

> /xf86-video-intel-2.16.0/src/intel_dri.c:885 - Dereferencing "drawable" (line
> #877) before a null check.

Technically true but harmless, the 'drawable' argument will be non-zero here because dixLookupDrawable() in the caller will have filled it in.

Comment 3 Kamil Dudka 2011-09-26 20:26:21 UTC
(In reply to comment #2)
> > /xf86-video-intel-2.16.0/src/i965_render.c:1240 - Overrunning static array
> > "i965_tex_formats", with 13 elements, at position 13 with index variable "i".
> 
> Coverity bug, this path is guarded by an assert() which makes that value a
> can't-happen.

True, but only for _debug_ build.  When building for production, the preprocessed code looks like this:

static uint32_t i965_get_card_format(PicturePtr picture)
{
    int i;

    for (i = 0; i < sizeof(i965_tex_formats) / sizeof(i965_tex_formats[0]);
            i++) {
        if (i965_tex_formats[i].fmt == picture->format)
            break;
    }
    ((void) (0));

    return i965_tex_formats[i].card_fmt;
}

> > /xf86-video-intel-2.16.0/src/intel_dri.c:885 - Dereferencing "drawable" (line
> > #877) before a null check.
> 
> Technically true but harmless, the 'drawable' argument will be non-zero here
> because dixLookupDrawable() in the caller will have filled it in.

Does it mean the NULL checks are there by mistake?  The NULL checks as they are now can never ever be fired...


Note You need to log in before you can comment on or make changes to this bug.