linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* lzo1x_decompress_safe: Macro compares unsigned to 0  (NO_EFFECT)
       [not found] <53b0f0f715b96_146f12c1338333fa@209.249.196.67.mail>
@ 2014-06-30  7:22 ` Richard Weinberger
  2014-06-30 14:37   ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2014-06-30  7:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: donb, markus, linux-kernel@vger.kernel.org

This was introduced by:
commit 206a81c18401c0cde6e579164f752c4b147324ce
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Fri Jun 20 22:00:53 2014 -0700

    lzo: properly check for overruns

Thanks,
//richard

-------- Original-Nachricht --------
Betreff: New Defects reported by Coverity Scan for Linux
Datum: Sun, 29 Jun 2014 22:09:11 -0700
Von: scan-admin@coverity.com


Hi,


Please find the latest report on new defect(s) introduced to Linux found with Coverity Scan.

Defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1224102:  Macro compares unsigned to 0  (NO_EFFECT)
/lib/lzo/lzo1x_decompress_safe.c: 225 in lzo1x_decompress_safe()


________________________________________________________________________________________________________
*** CID 1224102:  Macro compares unsigned to 0  (NO_EFFECT)
/lib/lzo/lzo1x_decompress_safe.c: 225 in lzo1x_decompress_safe()
219     			op += t;
220     			ip += t;
221     		} else
222     #endif
223     		{
224     			NEED_IP(t, 3);
>>>     CID 1224102:  Macro compares unsigned to 0  (NO_EFFECT)
>>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "t + 0UL >= 0UL".
225     			NEED_OP(t, 0);
226     			while (t > 0) {
227     				*op++ = *ip++;
228     				t--;
229     			}
230     		}


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, http://scan.coverity.com/projects/128?tab=overview

To unsubscribe from the email notification for new defects, http://scan5.coverity.com/cgi-bin/unsubscribe.py






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: lzo1x_decompress_safe: Macro compares unsigned to 0  (NO_EFFECT)
  2014-06-30  7:22 ` lzo1x_decompress_safe: Macro compares unsigned to 0 (NO_EFFECT) Richard Weinberger
@ 2014-06-30 14:37   ` Greg Kroah-Hartman
       [not found]     ` <CAFkuX4uoMFC1jT4Oeqj3HzfPWG3JFiEnysODEopfL8aQod4_mQ@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-06-30 14:37 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: donb, markus, linux-kernel@vger.kernel.org

On Mon, Jun 30, 2014 at 09:22:47AM +0200, Richard Weinberger wrote:
> This was introduced by:
> commit 206a81c18401c0cde6e579164f752c4b147324ce
> Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Date:   Fri Jun 20 22:00:53 2014 -0700
> 
>     lzo: properly check for overruns
> 
> Thanks,
> //richard
> 
> -------- Original-Nachricht --------
> Betreff: New Defects reported by Coverity Scan for Linux
> Datum: Sun, 29 Jun 2014 22:09:11 -0700
> Von: scan-admin@coverity.com
> 
> 
> Hi,
> 
> 
> Please find the latest report on new defect(s) introduced to Linux found with Coverity Scan.
> 
> Defect(s) Reported-by: Coverity Scan
> Showing 1 of 1 defect(s)
> 
> 
> ** CID 1224102:  Macro compares unsigned to 0  (NO_EFFECT)
> /lib/lzo/lzo1x_decompress_safe.c: 225 in lzo1x_decompress_safe()
> 
> 
> ________________________________________________________________________________________________________
> *** CID 1224102:  Macro compares unsigned to 0  (NO_EFFECT)
> /lib/lzo/lzo1x_decompress_safe.c: 225 in lzo1x_decompress_safe()
> 219     			op += t;
> 220     			ip += t;
> 221     		} else
> 222     #endif
> 223     		{
> 224     			NEED_IP(t, 3);
> >>>     CID 1224102:  Macro compares unsigned to 0  (NO_EFFECT)
> >>>     This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "t + 0UL >= 0UL".
> 225     			NEED_OP(t, 0);
> 226     			while (t > 0) {
> 227     				*op++ = *ip++;
> 228     				t--;
> 229     			}
> 230     		}
> 
> 
> ________________________________________________________________________________________________________

Looks like coverity needs to fix their "this is how you test for an
overflow" logic, right?  Or did I get the test wrong?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: lzo1x_decompress_safe: Macro compares unsigned to 0 (NO_EFFECT)
       [not found]     ` <CAFkuX4uoMFC1jT4Oeqj3HzfPWG3JFiEnysODEopfL8aQod4_mQ@mail.gmail.com>
@ 2014-06-30 16:23       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2014-06-30 16:23 UTC (permalink / raw)
  To: Don A. Bailey
  Cc: Richard Weinberger, Markus Oberhumer,
	linux-kernel@vger.kernel.org

On Mon, Jun 30, 2014 at 09:34:44AM -0600, Don A. Bailey wrote:
> In the case of macro instances that include a '0', the overflow test is
> purposefully benign. We don't need a test for these cases. It was easy to throw
> a '0' in there to accommodate for the new two-param call. But, to appease
> Coverity, a second single-param macro that doesn't check for overflow could be
> created. 

Not needed, we don't need to "apease" coverity :)

Let's just leave this as-is.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-30 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <53b0f0f715b96_146f12c1338333fa@209.249.196.67.mail>
2014-06-30  7:22 ` lzo1x_decompress_safe: Macro compares unsigned to 0 (NO_EFFECT) Richard Weinberger
2014-06-30 14:37   ` Greg Kroah-Hartman
     [not found]     ` <CAFkuX4uoMFC1jT4Oeqj3HzfPWG3JFiEnysODEopfL8aQod4_mQ@mail.gmail.com>
2014-06-30 16:23       ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).