summaryrefslogtreecommitdiffstats
path: root/src/net/tcpip.c
diff options
context:
space:
mode:
authorMichael Brown2015-03-13 11:19:44 +0100
committerMichael Brown2015-03-13 11:19:44 +0100
commit57bab4e1d3c5ffae8f7c698937d20a01222275c5 (patch)
treea19bc08f6be21bbaf8f18cda72e21ed5c44746d4 /src/net/tcpip.c
parent[smsc75xx] Move RX FIFO overflow message to DBGLVL_EXTRA (diff)
downloadipxe-57bab4e1d3c5ffae8f7c698937d20a01222275c5.tar.gz
ipxe-57bab4e1d3c5ffae8f7c698937d20a01222275c5.tar.xz
ipxe-57bab4e1d3c5ffae8f7c698937d20a01222275c5.zip
[tcpip] Fix dubious calculation of min_port
Detected using sparse. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/tcpip.c')
-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 261da582..5ad982fd 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++ ) {