Skip to content

Commit a90fb6c

Browse files
committed
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. MFC after: 1 week Sponsored by: Mellanox Technologies
1 parent 6f2b877 commit a90fb6c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sys/kern/sys_generic.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,19 @@ int
652652
sys_ioctl(struct thread *td, struct ioctl_args *uap)
653653
{
654654
u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(SYS_IOCTL_SMALL_ALIGN);
655-
u_long com;
655+
uint32_t com;
656656
int arg, error;
657657
u_int size;
658658
caddr_t data;
659659

660+
#ifdef INVARIANTS
660661
if (uap->com > 0xffffffff) {
661662
printf(
662663
"WARNING pid %d (%s): ioctl sign-extension ioctl %lx\n",
663664
td->td_proc->p_pid, td->td_name, uap->com);
664-
uap->com &= 0xffffffff;
665665
}
666-
com = uap->com;
666+
#endif
667+
com = (uint32_t)uap->com;
667668

668669
/*
669670
* Interpret high order word to find amount of data to be

0 commit comments

Comments
 (0)