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]
Date:	Sun, 24 Jan 2010 22:41:22 -0800 (PST)
From:	David Miller <davem@...emloft.net>
To:	shemminger@...tta.com
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] tcp_probe: avoid modulus operation and wrap fix

From: Stephen Hemminger <shemminger@...tta.com>
Date: Sun, 24 Jan 2010 21:50:01 -0800

> @@ -75,12 +75,12 @@ static struct {
>  
>  static inline int tcp_probe_used(void)
>  {
> -	return (tcp_probe.head - tcp_probe.tail) % bufsize;
> +	return (tcp_probe.head - tcp_probe.tail) & (bufsize - 1);
>  }
>  
>  static inline int tcp_probe_avail(void)
>  {
> -	return bufsize - tcp_probe_used();
> +	return bufsize - tcp_probe_used() - 1;
>  }
>  
>  /*

Hmmm...  When the ring is full head==tail, which means
tcp_probe_used() returns 0.  Which would now make tcp_probe_avail()
return "bufsize - 0 - 1".

Is that right?
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ