mirror of https://github.com/ipxe/ipxe.git
[tcpip] Fix dubious calculation of min_port
Detected using sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/35/head
parent
7f80eb511e
commit
57bab4e1d3
|
@ -235,7 +235,7 @@ int tcpip_bind ( struct sockaddr_tcpip *st_local,
|
||||||
/* Otherwise, find an available port in the range [1,1023] or
|
/* Otherwise, find an available port in the range [1,1023] or
|
||||||
* [1025,65535] as appropriate.
|
* [1025,65535] as appropriate.
|
||||||
*/
|
*/
|
||||||
min_port = ( ( ( ! flags ) & TCPIP_BIND_PRIVILEGED ) + 1 );
|
min_port = ( ( ( ~flags ) & TCPIP_BIND_PRIVILEGED ) + 1 );
|
||||||
max_port = ( ( flags & TCPIP_BIND_PRIVILEGED ) - 1 );
|
max_port = ( ( flags & TCPIP_BIND_PRIVILEGED ) - 1 );
|
||||||
offset = random();
|
offset = random();
|
||||||
for ( i = 0 ; i <= max_port ; i++ ) {
|
for ( i = 0 ; i <= max_port ; i++ ) {
|
||||||
|
|
Loading…
Reference in New Issue