diff --git a/libc/Kconfig b/libc/Kconfig index 2c31a198316..b49b92e31dc 100644 --- a/libc/Kconfig +++ b/libc/Kconfig @@ -74,6 +74,10 @@ config LIBC_IOCTL_VARIADIC compatibility if you are porting code from other platforms that use the variadic ioctl() function. + WARNING: Use of this option could cause subtle system errors is + the third argument is omitted or if the sizeof the thread argument + is anything other than sizeof (unsigned long). + config LIB_RAND_ORDER int "Order of the random number generate" default 1 diff --git a/libc/misc/lib_ioctl.c b/libc/misc/lib_ioctl.c index 9ef09fcd963..65932c12de5 100644 --- a/libc/misc/lib_ioctl.c +++ b/libc/misc/lib_ioctl.c @@ -87,10 +87,14 @@ int ioctl(int fd, int req, ...) va_list ap; unsigned long arg; - /* Get the unsigned long argument */ + /* Get the unsigned long argument. + * + * REVISIT: This could cause of the crash down the road if the actual size + * of the argument is anything other than sizeof(unsigned long); + */ va_start(ap, req); - arg = va_arg(ap, unsigned long ); + arg = va_arg(ap, unsigned long); va_end(ap); /* Then let fs_ioctl() to the real work */