Bug 9564 - Uninitialzed variable fields cvt.h_margin and cvt.v_margin
Summary: Uninitialzed variable fields cvt.h_margin and cvt.v_margin
Status: REJECTED WILL_NOT_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(Other) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_video-other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-14 13:54 UTC by Marcio Buss
Modified: 2008-09-24 03:39 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.23
Subsystem:
Regression: ---
Bisected commit-id:


Attachments

Description Marcio Buss 2007-12-14 13:54:58 UTC
The errors can be found at drivers/video/fbcvt.c as follows:

(1) the test "if (margin)" at line 310 evaluates to false,
(2) this makes the test "if (cvt.flags & FB_CVT_FLAG_MARGINS)" at line 352
    to evaluate to false as well
(3) now cvt.h_margin is uninitialized at line 359, 368, and 370, and
    cvt.v_margin is uninitizalied at line 371.

In other words, both cvt.v_margin and cvt.h_margin are initialized conditinally
but used unconditionally. This bug is a false positive only if the parameter
"margins" at line 304 is never 0. However, this would make the test at line
310 unnecessary -- anyone looking at the code is miled into believing that
0 is a legal value for "margins". This means the code does require some change
in my humble opinion.
Comment 1 Anonymous Emailer 2008-01-18 14:01:07 UTC
Reply-To: akpm@linux-foundation.org

On Fri, 14 Dec 2007 13:54:59 -0800 (PST)
bugme-daemon@bugzilla.kernel.org wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=9564
> 
>            Summary: Uninitialzed variable fields cvt.h_margin and
>                     cvt.v_margin
>            Product: Drivers
>            Version: 2.5
>      KernelVersion: 2.6.23
>           Platform: All
>         OS/Version: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: Video(Other)
>         AssignedTo: drivers_video-other@kernel-bugs.osdl.org
>         ReportedBy: marciobuss@gmail.com
> 
> 
> The errors can be found at drivers/video/fbcvt.c as follows:
> 
> (1) the test "if (margin)" at line 310 evaluates to false,
> (2) this makes the test "if (cvt.flags & FB_CVT_FLAG_MARGINS)" at line 352
>     to evaluate to false as well
> (3) now cvt.h_margin is uninitialized at line 359, 368, and 370, and
>     cvt.v_margin is uninitizalied at line 371.
> 
> In other words, both cvt.v_margin and cvt.h_margin are initialized
> conditinally
> but used unconditionally. This bug is a false positive only if the parameter
> "margins" at line 304 is never 0. However, this would make the test at line
> 310 unnecessary -- anyone looking at the code is miled into believing that
> 0 is a legal value for "margins". This means the code does require some
> change
> in my humble opinion.
> 

Could someone please take a look at this?
Comment 2 Cyrill Gorcunov 2008-01-19 01:11:23 UTC
but what about

    memset(&cvt, 0, sizeof(cvt));

doesn't it set cvt.h_margin and cvt.v_margin to 0 as well?
did I miss something?
Comment 3 Cyrill Gorcunov 2008-01-19 01:12:40 UTC
oh, wait... drop my message ;)
Comment 4 Cyrill Gorcunov 2008-01-19 13:49:36 UTC
well, the question is - how it *should* work. I mean these 1.8% should be involved in calculations anyway? (i've been playing with CVT calculator from VESA based on xsl file - but it didn't make the situation clear). I've a strong feeling that 1.8% should be used anyway but not sure...
Comment 5 Cyrill Gorcunov 2008-01-21 09:29:07 UTC
[Andrew Morton - Fri, Jan 18, 2008 at 02:00:55PM -0800]
| On Fri, 14 Dec 2007 13:54:59 -0800 (PST)
| bugme-daemon@bugzilla.kernel.org wrote:
| 
| > http://bugzilla.kernel.org/show_bug.cgi?id=9564
| > 
| >            Summary: Uninitialzed variable fields cvt.h_margin and
| >                     cvt.v_margin
| >            Product: Drivers
| >            Version: 2.5
| >      KernelVersion: 2.6.23
| >           Platform: All
| >         OS/Version: Linux
| >               Tree: Mainline
| >             Status: NEW
| >           Severity: normal
| >           Priority: P1
| >          Component: Video(Other)
| >         AssignedTo: drivers_video-other@kernel-bugs.osdl.org
| >         ReportedBy: marciobuss@gmail.com
| > 
| > 
| > The errors can be found at drivers/video/fbcvt.c as follows:
| > 
| > (1) the test "if (margin)" at line 310 evaluates to false,
| > (2) this makes the test "if (cvt.flags & FB_CVT_FLAG_MARGINS)" at line 352
| >     to evaluate to false as well
| > (3) now cvt.h_margin is uninitialized at line 359, 368, and 370, and
| >     cvt.v_margin is uninitizalied at line 371.
| > 
| > In other words, both cvt.v_margin and cvt.h_margin are initialized conditinally
| > but used unconditionally. This bug is a false positive only if the parameter
| > "margins" at line 304 is never 0. However, this would make the test at line
| > 310 unnecessary -- anyone looking at the code is miled into believing that
| > 0 is a legal value for "margins". This means the code does require some change
| > in my humble opinion.
| > 
| 
| Could someone please take a look at this?

unfortunelly, it's not really obvious what is the right way of
calculation. *should* the 1.8% margin be involved in calculation
all the time or 0 is legal too?

		- Cyrill -
Comment 6 Alan 2008-09-24 03:39:41 UTC
Closing stale bug

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