#include <linux/fs.h>
#include <linux/dirent.h>
#include <linux/security.h>
+#include <linux/syscalls.h>
+#include <linux/unistd.h>
#include <asm/uaccess.h>
* anyway. Thus the special "fillonedir()" function for that
* case (the low-level handlers don't need to care about this).
*/
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
-#ifndef __ia64__
+#ifdef __ARCH_WANT_OLD_READDIR
struct old_linux_dirent {
unsigned long d_ino;
return -EINVAL;
buf->result++;
dirent = buf->dirent;
- if (!access_ok(VERIFY_WRITE, (unsigned long)dirent,
+ if (!access_ok(VERIFY_WRITE, dirent,
(unsigned long)(dirent->d_name + namlen + 1) -
(unsigned long)dirent))
goto efault;
return error;
}
-#endif /* !__ia64__ */
+#endif /* __ARCH_WANT_OLD_READDIR */
/*
* New, all-improved, singing, dancing, iBCS2-compliant getdents()
goto efault;
if (__put_user(0, dirent->d_name + namlen))
goto efault;
- if (__put_user(d_type, (char *) dirent + reclen - 1))
+ if (__put_user(d_type, (char __user *) dirent + reclen - 1))
goto efault;
buf->previous = dirent;
dirent = (void __user *)dirent + reclen;
lastdirent = buf.previous;
if (lastdirent) {
typeof(lastdirent->d_off) d_off = file->f_pos;
- __put_user(d_off, &lastdirent->d_off);
+ error = -EFAULT;
+ if (__put_user(d_off, &lastdirent->d_off))
+ goto out_putf;
error = count - buf.count;
}