diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 8cca4c7bb21f04f4a5d136dbeed69ef9870ca97c..8c8714fcb53c35a390becf14f2fa8e1bfc20142c 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2133,6 +2133,8 @@ static int do_proc_douintvec_conv(bool *negp, unsigned long *lvalp,
 	if (write) {
 		if (*negp)
 			return -EINVAL;
+		if (*lvalp > UINT_MAX)
+			return -EINVAL;
 		*valp = *lvalp;
 	} else {
 		unsigned int val = *valp;