lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 5 May 2020 17:57:34 +0200
From: Pavel Machek <pavel@...x.de>
To: Sasha Levin <sashal@...nel.org>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
Pavel Machek <pavel@...x.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Stable <stable@...r.kernel.org>,
Dan Williams <dan.j.williams@...el.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Vinod Koul <vkoul@...nel.org>
Subject: Re: [PATCH 4.19 28/37] dmaengine: dmatest: Fix iteration non-stop
logic
On Tue 2020-05-05 11:32:27, Sasha Levin wrote:
> On Tue, May 05, 2020 at 05:05:37PM +0300, Andy Shevchenko wrote:
> > On Tue, May 5, 2020 at 4:37 PM Pavel Machek <pavel@...x.de> wrote:
> > > On Tue 2020-05-05 16:19:11, Andy Shevchenko wrote:
> > > > On Tue, May 5, 2020 at 3:58 PM Pavel Machek <pavel@...x.de> wrote:
> > > > > On Tue 2020-05-05 15:51:16, Andy Shevchenko wrote:
> > > > > > On Tue, May 5, 2020 at 3:37 PM Pavel Machek <pavel@...x.de> wrote:
> > > > > Yeah, I pointed that out above. Both && and || permit short
> > > > > execution. But that does not matter, as neither "params->iterations"
> > > > > nor "total_tests >= params->iterations" have side effects.
> > > > >
> > > > > Where is the runtime difference?
> > > >
> > > > We have to check *both* conditions. If we don't check iterations, we
> > > > just wait indefinitely until somebody tells us to stop.
> > > > Everything in the commit message and mentioned there commit IDs which
> > > > you may check.
> > >
> > > No.
> >
> > Yes. Please, read carefully the commit message (for your convenience I
> > emphasized above). I don't want to spend time on this basics stuff
> > anymore.
>
> I'm a bit confused about this too. Maybe it's too early in the morning,
> so I wrote this little test program:
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char *argv[])
> {
> int a = atoi(argv[1]);
> int b = atoi(argv[2]);
>
> if (!a && !b)
> printf("A");
> else
> printf("B");
>
> if (!(a || b))
> printf("A");
> else
> printf("B");
>
> printf("\n");
>
> return 0;
> }
>
> Andy, could you give an example of two values which will print something
> other than "AA" or "BB"?
The issue here is "sideffects". Does b have to be evaluated at all?
There is no difference between
int a, b;
if (a && b)
and
if ((!!a) & (!!b))
.
But there would be difference between
int a, b;
if (a && b++)
and
if ((!!a) & (!!(b++)))
But:
1) && and || behave same way w.r.t. side effects
2) in the patch we are talking about b has no important side effects
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists