All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Binderman <dcb314@hotmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Daeseok Youn <daeseok.youn@gmail.com>
Cc: "driverdev-devel@linuxdriverproject.org"
	<driverdev-devel@linuxdriverproject.org>
Subject: RE: staging/dgap/dgap.c:981: bad if test ?
Date: Thu, 22 Jan 2015 10:20:44 +0000	[thread overview]
Message-ID: <DUB128-W4490D09B40F58B7E63718F9C490@phx.gbl> (raw)
In-Reply-To: <20150122101422.GK6456@mwanda>

Hello there,

Thanks for the confirmation. More of the same in the same file:

[linux-3.19-rc5/drivers/staging/dgap/dgap.c:1022]: (warning) Logical disjunction always evaluates to true: module_type != 68 || module_type != 73.

Source code is

            if (module_type == 0 || module_type != PORTS ||
                module_type != MODEM) {

I used the static analyser cppcheck to find these two bugs, but
you might be able to find similar problems by using gcc compiler
flag -Wlogical-op.

Regards

David Binderman


----------------------------------------
> Date: Thu, 22 Jan 2015 13:14:22 +0300
> From: dan.carpenter@oracle.com
> To: dcb314@hotmail.com; daeseok.youn@gmail.com
> CC: driverdev-devel@linuxdriverproject.org
> Subject: Re: staging/dgap/dgap.c:981: bad if test ?
>
>
> On Thu, Jan 22, 2015 at 10:05:53AM +0000, David Binderman wrote:
>> Hello there,
>>
>> [linux-3.19-rc5/drivers/staging/dgap/dgap.c:981]: (warning) Logical disjunction always evaluates to true: conc_type != 65 || conc_type != 66.
>>
>> Source code is
>>
>>             if (conc_type == 0 || conc_type != CX ||
>>                 conc_type != EPC) {
>>
>> Suggest code rework.
>
> Thanks. This bug was introduced in:
>
> commit f6aa0164cd3b1c5192e87f5651ec382c3bc3abac
> Author: Daeseok Youn <daeseok.youn@gmail.com>
> Date: Sat Aug 9 14:38:41 2014 +0900
>
> staging: dgap: Simplify to set a concentrator type
>
> It is same manner with setting a board type.
> For example of config file for concentrator,
> "conc ccon" or
> "conc epcon"
>
> After allocating a type of "CNODE" then set a type of concentrator.
> So remove cases in swith statement, just get a token from string
> and set to "conc.type". And also it doesn't need to "conc.v_type".
>
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> Let's CC Daeseok.
>
> regards,
> dan carpenter
>
 		 	   		  
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2015-01-22 10:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 10:05 staging/dgap/dgap.c:981: bad if test ? David Binderman
2015-01-22 10:14 ` Dan Carpenter
2015-01-22 10:20   ` David Binderman [this message]
2015-01-22 10:37     ` Dan Carpenter
2015-01-22 10:44       ` David Binderman
2015-01-23  0:19   ` DaeSeok Youn

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=DUB128-W4490D09B40F58B7E63718F9C490@phx.gbl \
    --to=dcb314@hotmail.com \
    --cc=daeseok.youn@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=driverdev-devel@linuxdriverproject.org \
    /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.