svn commit: r360331 - stable/11/sys/kern

Hans Petter Selasky hselasky at FreeBSD.org
Sun Apr 26 08:34:53 UTC 2020


Author: hselasky
Date: Sun Apr 26 08:34:52 2020
New Revision: 360331
URL: https://svnweb.freebsd.org/changeset/base/360331

Log:
  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

Modified:
  stable/11/sys/kern/sys_generic.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/sys_generic.c
==============================================================================
--- stable/11/sys/kern/sys_generic.c	Sun Apr 26 08:34:03 2020	(r360330)
+++ stable/11/sys/kern/sys_generic.c	Sun Apr 26 08:34:52 2020	(r360331)
@@ -688,18 +688,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


More information about the svn-src-all mailing list