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] [day] [month] [year] [list]
Date:	Sat, 07 Jun 2014 19:38:42 +0200
From:	Krzysztof Halasa <khc@...waw.pl>
To:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
Cc:	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: wan: wanxl.c:  Cleaning up declaration of a while loop

Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se> writes:

> Unusual declaration of a while loop.
> However, believe you also want to make sure that the pointer is not NULL

Not really. The code is meant to do exactly what it currently does -
set variable desc and then check desc->stat.
All rx_descs are at this point already initialized and not NULL
(if desc was indeed NULL we better BUG*() or Oops on desc->stat access
instead of failing silently).

> --- a/drivers/net/wan/wanxl.c
> +++ b/drivers/net/wan/wanxl.c
> @@ -196,7 +196,7 @@ static inline void wanxl_tx_intr(port_t *port)
>  static inline void wanxl_rx_intr(card_t *card)
>  {
>  	desc_t *desc;
> -	while (desc = &card->status->rx_descs[card->rx_in],
> +	while (desc = &card->status->rx_descs[card->rx_in] &&
>  	       desc->stat != PACKET_EMPTY) {
>  		if ((desc->stat & PACKET_PORT_MASK) > card->n_ports)
>  			pr_crit("%s: received packet for nonexistent port\n",

-- 
Krzysztof Halasa
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists