diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-23 17:07:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-22 23:31:31 -0500 |
commit | 496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (patch) | |
tree | 8f4abde793cd7db5bb8fde6d27ebcacd0e54379a /arch/x86 | |
parent | 57eccb830f1cc93d4b506ba306d8dfa685e0c88f (diff) |
new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/ia32/ia32_aout.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpuid.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index a703af19c281..03abf9b70011 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
@@ -271,7 +271,7 @@ static int load_aout_binary(struct linux_binprm *bprm) | |||
271 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && | 271 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != OMAGIC && |
272 | N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || | 272 | N_MAGIC(ex) != QMAGIC && N_MAGIC(ex) != NMAGIC) || |
273 | N_TRSIZE(ex) || N_DRSIZE(ex) || | 273 | N_TRSIZE(ex) || N_DRSIZE(ex) || |
274 | i_size_read(bprm->file->f_path.dentry->d_inode) < | 274 | i_size_read(file_inode(bprm->file)) < |
275 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { | 275 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { |
276 | return -ENOEXEC; | 276 | return -ENOEXEC; |
277 | } | 277 | } |
@@ -425,12 +425,10 @@ beyond_if: | |||
425 | 425 | ||
426 | static int load_aout_library(struct file *file) | 426 | static int load_aout_library(struct file *file) |
427 | { | 427 | { |
428 | struct inode *inode; | ||
429 | unsigned long bss, start_addr, len, error; | 428 | unsigned long bss, start_addr, len, error; |
430 | int retval; | 429 | int retval; |
431 | struct exec ex; | 430 | struct exec ex; |
432 | 431 | ||
433 | inode = file->f_path.dentry->d_inode; | ||
434 | 432 | ||
435 | retval = -ENOEXEC; | 433 | retval = -ENOEXEC; |
436 | error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); | 434 | error = kernel_read(file, 0, (char *) &ex, sizeof(ex)); |
@@ -440,7 +438,7 @@ static int load_aout_library(struct file *file) | |||
440 | /* We come in here for the regular a.out style of shared libraries */ | 438 | /* We come in here for the regular a.out style of shared libraries */ |
441 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC) || N_TRSIZE(ex) || | 439 | if ((N_MAGIC(ex) != ZMAGIC && N_MAGIC(ex) != QMAGIC) || N_TRSIZE(ex) || |
442 | N_DRSIZE(ex) || ((ex.a_entry & 0xfff) && N_MAGIC(ex) == ZMAGIC) || | 440 | N_DRSIZE(ex) || ((ex.a_entry & 0xfff) && N_MAGIC(ex) == ZMAGIC) || |
443 | i_size_read(inode) < | 441 | i_size_read(file_inode(file)) < |
444 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { | 442 | ex.a_text+ex.a_data+N_SYMSIZE(ex)+N_TXTOFF(ex)) { |
445 | goto out; | 443 | goto out; |
446 | } | 444 | } |
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c index 60c78917190c..1e4dbcfe6d31 100644 --- a/arch/x86/kernel/cpuid.c +++ b/arch/x86/kernel/cpuid.c | |||
@@ -85,7 +85,7 @@ static ssize_t cpuid_read(struct file *file, char __user *buf, | |||
85 | { | 85 | { |
86 | char __user *tmp = buf; | 86 | char __user *tmp = buf; |
87 | struct cpuid_regs cmd; | 87 | struct cpuid_regs cmd; |
88 | int cpu = iminor(file->f_path.dentry->d_inode); | 88 | int cpu = iminor(file_inode(file)); |
89 | u64 pos = *ppos; | 89 | u64 pos = *ppos; |
90 | ssize_t bytes = 0; | 90 | ssize_t bytes = 0; |
91 | int err = 0; | 91 | int err = 0; |
@@ -116,7 +116,7 @@ static int cpuid_open(struct inode *inode, struct file *file) | |||
116 | unsigned int cpu; | 116 | unsigned int cpu; |
117 | struct cpuinfo_x86 *c; | 117 | struct cpuinfo_x86 *c; |
118 | 118 | ||
119 | cpu = iminor(file->f_path.dentry->d_inode); | 119 | cpu = iminor(file_inode(file)); |
120 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) | 120 | if (cpu >= nr_cpu_ids || !cpu_online(cpu)) |
121 | return -ENXIO; /* No such CPU */ | 121 | return -ENXIO; /* No such CPU */ |
122 | 122 | ||