mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
vfs: fix warning: 'dirent' is used uninitialized in this function
Using: gcc (GCC) 4.5.0 20100610 (prerelease) The following warnings appear: fs/readdir.c: In function `filldir64': fs/readdir.c:240:15: warning: `dirent' is used uninitialized in this function fs/readdir.c: In function `filldir': fs/readdir.c:155:15: warning: `dirent' is used uninitialized in this function fs/compat.c: In function `compat_filldir64': fs/compat.c:1071:11: warning: `dirent' is used uninitialized in this function fs/compat.c: In function `compat_filldir': fs/compat.c:984:15: warning: `dirent' is used uninitialized in this function The warnings are related to the use of the NAME_OFFSET() macro. Luckily, it appears as though the standard offsetof() macro is what is being implemented by NAME_OFFSET(), thus we can fix the warning and use a more standard code construct at the same time. Signed-off-by: Kevin Winchester <[email protected]> Cc: Al Viro <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
d89b1945b7
commit
85c9fe8fca
2 changed files with 10 additions and 8 deletions
10
fs/compat.c
10
fs/compat.c
|
|
@ -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>
|
||||
|
|
@ -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;
|
||||
|
|
@ -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)
|
||||
|
|
@ -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.. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue