david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[tcpip] Fix dubious calculation of min_port

Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2015-03-13 10:19:44 +00:00
parent 7f80eb511e
commit 57bab4e1d3
1 changed files with 1 additions and 1 deletions

View File

@ -235,7 +235,7 @@ int tcpip_bind ( struct sockaddr_tcpip *st_local,
/* Otherwise, find an available port in the range [1,1023] or
* [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 );
offset = random();
for ( i = 0 ; i <= max_port ; i++ ) {