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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200714064323.GB12651@blackclown>
Date:   Tue, 14 Jul 2020 12:13:23 +0530
From:   Suraj Upadhyay <usuraj35@...il.com>
To:     Benjamin Poirier <benjamin.poirier@...il.com>,
        maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
        tzimmermann@...e.de, airlied@...ux.ie, daniel@...ll.ch
Cc:     linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH 4/6] staging: qlge: qlge_main: Simplify while statements.

On Tue, Jul 14, 2020 at 02:41:37PM +0900, Benjamin Poirier wrote:
> On 2020-07-13 17:50 +0530, Suraj Upadhyay wrote:
> > Simplify while loops into more readable and simple for loops.
> > 
> > Signed-off-by: Suraj Upadhyay <usuraj35@...il.com>
> > ---
> [...]
> > @@ -1824,7 +1821,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
> >  			sbq_desc->p.skb = NULL;
> >  			skb_reserve(skb, NET_IP_ALIGN);
> >  		}
> > -		do {
> > +		for (; length > 0; length -= size, i++) {
> >  			lbq_desc = ql_get_curr_lchunk(qdev, rx_ring);
> >  			size = min(length, qdev->lbq_buf_size);
> >  
> > @@ -1839,7 +1836,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
> >  			skb->truesize += size;
> >  			length -= size;
> >  			i++;
> > -		} while (length > 0);
> > +		}
> 
> Looks like length and i modification should be removed from here. But in
> this instance, maybe the original was better anyways.
 
Thanks for pointing that out. It nearly slipped.

> Agreed with Dan. At least some of those loops can be converted to "count
> up" loops for a more familiar appearance.

I mostly tried to convert the do-while loops, which I think are't that
obvious than while and for loops.

Thanks,

Suraj Upadhyay.


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ