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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 5 May 2020 14:31:59 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, 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

Hi!

> So, to the point, the conditional of checking the thread to be stopped being
> first part of conjunction logic prevents to check iterations. Thus, we have to
> always check both conditions to be able to stop after given
> iterations.

I ... don't understand. AFAICT the code is equivalent. Both && and ||
operators permit "short" execution... but second part of expression
has no sideeffects, so...

> @@ -567,8 +567,8 @@ static int dmatest_func(void *data)
>  	flags = DMA_CTRL_ACK | DMA_PREP_INTERRUPT;
>  
>  	ktime = ktime_get();
> -	while (!kthread_should_stop()
> -	       && !(params->iterations && total_tests >= params->iterations)) {
> +	while (!(kthread_should_stop() ||
> +	       (params->iterations && total_tests >= params->iterations))) {
>  		struct dma_async_tx_descriptor *tx = NULL;
>  		struct dmaengine_unmap_data *um;
>  		dma_addr_t *dsts;

let a = kthread_should_stop()
let b = (params->iterations && total_tests >= params->iterations)

You are changing !a & !b into !(a | b). But that's equivalent
expression. I hate to admit, but I had to draw truth table to prove
that.

!a & !b   0 0 -> 1
       	  else -> 0

!(a | b)  0 0 -> 1
     	   else -> 0
	   
What am I missing?

Best regards,
								Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists