From 4934367e7956fd30de36510100efba9395cfbffc Mon Sep 17 00:00:00 2001 From: hselasky Date: Sun, 26 Apr 2020 08:35:32 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.freebsd.org/base/stable/10@360332 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/kern/sys_generic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 04213c006..878167692 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 -- 2.42.0