From 1a22ede31c2642913f9cd4c23602adbe413f6f76 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 29 Nov 2014 10:59:41 -0600 Subject: [PATCH] Add some comments --- libc/Kconfig | 4 ++++ libc/misc/lib_ioctl.c | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libc/Kconfig b/libc/Kconfig index 2c31a19831..b49b92e31d 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 9ef09fcd96..65932c12de 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 */