Bug 44051 - cx25821-medusa-video.c:502: bad if test
Summary: cx25821-medusa-video.c:502: bad if test
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Video(Other) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Alan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-01 14:20 UTC by David Binderman
Modified: 2012-08-15 21:50 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.5-rc5
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description David Binderman 2012-07-01 14:20:19 UTC
I just ran the static analyser cppcheck over the source code of the
linux kernel version 3.5-rc5.

It said

[linux-3.5-rc5/drivers/media/video/cx25821/cx25821-medusa-video.c:502]: (warning) Logical conjunction always evaluates to false: decoder < 0 && decoder > 7.


The source code is

    if (decoder < VDEC_A && decoder > VDEC_H) {

I think you might be better off with 

    if (decoder < VDEC_A || decoder > VDEC_H) {
Comment 1 Alan 2012-07-02 12:44:37 UTC
Patch queued
Comment 2 Florian Mickler 2012-08-04 19:11:17 UTC
A patch referencing this bug report has been merged in Linux v3.6-rc1:

commit c79a3c352469ea0a9cb2ed9e32c1932a7ff66c5c
Author: Alan Cox <alan@linux.intel.com>
Date:   Tue Jul 24 12:00:24 2012 -0300

    [media] cx25821,medusa: incorrect check on decoder type

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