aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2020-04-26 08:35:32 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2020-04-26 08:35:32 +0000
commitd623c63a6632d4e929969ae351c16b067c397385 (patch)
treed2abb0aa0362a8c8172f5ed94a0b546ac099e938
parent49b84632c5cda01f0196248ef959fd833f4d3100 (diff)
downloadsrc-d623c63a6632d4e929969ae351c16b067c397385.tar.gz
src-d623c63a6632d4e929969ae351c16b067c397385.zip
MFC r359968:
Cast all ioctl command arguments through uint32_t internally. Hide debug print showing use of sign extended ioctl command argument under INVARIANTS. The print is available to all and can easily fill up the logs. No functional change intended. Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/stable/10/; revision=360332
-rw-r--r--sys/kern/sys_generic.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 04213c006e52..878167692eb0 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -663,18 +663,19 @@ int
sys_ioctl(struct thread *td, struct ioctl_args *uap)
{
u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(SYS_IOCTL_SMALL_ALIGN);
- u_long com;
+ uint32_t com;
int arg, error;
u_int size;
caddr_t data;
+#ifdef INVARIANTS
if (uap->com > 0xffffffff) {
printf(
"WARNING pid %d (%s): ioctl sign-extension ioctl %lx\n",
td->td_proc->p_pid, td->td_name, uap->com);
- uap->com &= 0xffffffff;
}
- com = uap->com;
+#endif
+ com = (uint32_t)uap->com;
/*
* Interpret high order word to find amount of data to be