aboutsummaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2015-03-13 10:19:44 +0000
committerMichael Brown <mcb30@ipxe.org>2015-03-13 10:19:44 +0000
commit57bab4e1d3c5ffae8f7c698937d20a01222275c5 (patch)
treea19bc08f6be21bbaf8f18cda72e21ed5c44746d4 /src/net
parent7f80eb511e9bbbf74de56d110f351f0b1b052d76 (diff)
downloadipxe-57bab4e1d3c5ffae8f7c698937d20a01222275c5.zip
ipxe-57bab4e1d3c5ffae8f7c698937d20a01222275c5.tar.gz
ipxe-57bab4e1d3c5ffae8f7c698937d20a01222275c5.tar.bz2
[tcpip] Fix dubious calculation of min_port
Detected using sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net')
-rw-r--r--src/net/tcpip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/tcpip.c b/src/net/tcpip.c
index 261da58..5ad982f 100644
--- a/src/net/tcpip.c
+++ b/src/net/tcpip.c
@@ -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++ ) {