Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 207294
b: refs/heads/master
c: 85c9fe8
h: refs/heads/master
v: v3
  • Loading branch information
Kevin Winchester authored and Linus Torvalds committed Aug 10, 2010
1 parent 66f73af commit 6bec12a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d89b1945b760a6e0e887da004d68432c0bff899a
refs/heads/master: 85c9fe8fcaf630225b26047b3a7cc5167739eced
10 changes: 5 additions & 5 deletions trunk/fs/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* published by the Free Software Foundation.
*/

#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/linkage.h>
#include <linux/compat.h>
Expand Down Expand Up @@ -891,8 +892,6 @@ asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name,
return retval;
}

#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))

struct compat_old_linux_dirent {
compat_ulong_t d_ino;
compat_ulong_t d_offset;
Expand Down Expand Up @@ -981,7 +980,8 @@ static int compat_filldir(void *__buf, const char *name, int namlen,
struct compat_linux_dirent __user * dirent;
struct compat_getdents_callback *buf = __buf;
compat_ulong_t d_ino;
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(compat_long_t));
int reclen = ALIGN(offsetof(struct compat_linux_dirent, d_name) +
namlen + 2, sizeof(compat_long_t));

buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
Expand Down Expand Up @@ -1068,8 +1068,8 @@ static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t
{
struct linux_dirent64 __user *dirent;
struct compat_getdents_callback64 *buf = __buf;
int jj = NAME_OFFSET(dirent);
int reclen = ALIGN(jj + namlen + 1, sizeof(u64));
int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
sizeof(u64));
u64 off;

buf->error = -EINVAL; /* only used if we fail.. */
Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 1995 Linus Torvalds
*/

#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/time.h>
Expand Down Expand Up @@ -54,7 +55,6 @@ EXPORT_SYMBOL(vfs_readdir);
* 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 __user *) (de)))

#ifdef __ARCH_WANT_OLD_READDIR

Expand Down Expand Up @@ -152,7 +152,8 @@ static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
struct linux_dirent __user * dirent;
struct getdents_callback * buf = (struct getdents_callback *) __buf;
unsigned long d_ino;
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(long));
int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2,
sizeof(long));

buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
Expand Down Expand Up @@ -237,7 +238,8 @@ static int filldir64(void * __buf, const char * name, int namlen, loff_t offset,
{
struct linux_dirent64 __user *dirent;
struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf;
int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(u64));
int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
sizeof(u64));

buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
Expand Down

0 comments on commit 6bec12a

Please sign in to comment.