summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_ktr.c2
-rw-r--r--sys/kern/subr_mchain.c1
-rw-r--r--sys/kern/uipc_debug.c6
-rw-r--r--sys/kern/uipc_sockbuf.c1
-rw-r--r--sys/kern/uipc_socket.c10
5 files changed, 14 insertions, 6 deletions
diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c
index 6885706..1af3b94 100644
--- a/sys/kern/kern_ktr.c
+++ b/sys/kern/kern_ktr.c
@@ -419,7 +419,7 @@ DB_SHOW_COMMAND(ktr, db_ktr_all)
db_ktr_verbose |= (strchr(modif, 'V') != NULL) ? 1 : 0; /* just timestap please */
if (strchr(modif, 'a') != NULL) {
db_disable_pager();
- while (cncheckc() != -1)
+ while (cncheckc() == -1)
if (db_mach_vtrace() == 0)
break;
} else {
diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c
index e9d7d22..233a78a 100644
--- a/sys/kern/subr_mchain.c
+++ b/sys/kern/subr_mchain.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/endian.h>
#include <sys/errno.h>
+#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/module.h>
#include <sys/uio.h>
diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c
index caecad9..7c8b93c 100644
--- a/sys/kern/uipc_debug.c
+++ b/sys/kern/uipc_debug.c
@@ -461,9 +461,9 @@ db_print_socket(struct socket *so, const char *socketname, int indent)
db_print_indent(indent);
/* so_list skipped */
- db_printf("so_qlen: %d ", so->so_qlen);
- db_printf("so_incqlen: %d ", so->so_incqlen);
- db_printf("so_qlimit: %d ", so->so_qlimit);
+ db_printf("so_qlen: %u ", so->so_qlen);
+ db_printf("so_incqlen: %u ", so->so_incqlen);
+ db_printf("so_qlimit: %u ", so->so_qlimit);
db_printf("so_timeo: %d ", so->so_timeo);
db_printf("so_error: %d\n", so->so_error);
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index ba77fca..edf03a3 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/aio.h> /* for aio_swake proto */
#include <sys/kernel.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/proc.h>
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 350ca3c..5d2247f 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -196,7 +196,7 @@ VNET_DEFINE(struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST + 1]);
* NB: The orginal sysctl somaxconn is still available but hidden
* to prevent confusion about the actual purpose of this number.
*/
-static int somaxconn = SOMAXCONN;
+static u_int somaxconn = SOMAXCONN;
static int
sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
@@ -209,7 +209,13 @@ sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
if (error || !req->newptr )
return (error);
- if (val < 1 || val > USHRT_MAX)
+ /*
+ * The purpose of the UINT_MAX / 3 limit, is so that the formula
+ * 3 * so_qlimit / 2
+ * below, will not overflow.
+ */
+
+ if (val < 1 || val > UINT_MAX / 3)
return (EINVAL);
somaxconn = val;
OpenPOWER on IntegriCloud