@@ -1700,7 +1700,7 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
17001700 struct dentry * new ;
17011701 new = d_alloc (dir , & qname );
17021702 if (new ) {
1703- child = instantiate (dir -> d_inode , new , task , ptr );
1703+ child = ERR_PTR ( instantiate (dir -> d_inode , new , task , ptr ));
17041704 if (child )
17051705 dput (new );
17061706 else
@@ -1844,7 +1844,7 @@ struct map_files_info {
18441844 unsigned char name [4 * sizeof (long )+2 ]; /* max: %lx-%lx\0 */
18451845};
18461846
1847- static struct dentry *
1847+ static int
18481848proc_map_files_instantiate (struct inode * dir , struct dentry * dentry ,
18491849 struct task_struct * task , const void * ptr )
18501850{
@@ -1854,7 +1854,7 @@ proc_map_files_instantiate(struct inode *dir, struct dentry *dentry,
18541854
18551855 inode = proc_pid_make_inode (dir -> i_sb , task );
18561856 if (!inode )
1857- return ERR_PTR ( - ENOENT ) ;
1857+ return - ENOENT ;
18581858
18591859 ei = PROC_I (inode );
18601860 ei -> op .proc_get_link = proc_map_files_get_link ;
@@ -1871,7 +1871,7 @@ proc_map_files_instantiate(struct inode *dir, struct dentry *dentry,
18711871 d_set_d_op (dentry , & tid_map_files_dentry_operations );
18721872 d_add (dentry , inode );
18731873
1874- return NULL ;
1874+ return 0 ;
18751875}
18761876
18771877static struct dentry * proc_map_files_lookup (struct inode * dir ,
@@ -1880,23 +1880,23 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
18801880 unsigned long vm_start , vm_end ;
18811881 struct vm_area_struct * vma ;
18821882 struct task_struct * task ;
1883- struct dentry * result ;
1883+ int result ;
18841884 struct mm_struct * mm ;
18851885
1886- result = ERR_PTR ( - EPERM ) ;
1886+ result = - EPERM ;
18871887 if (!capable (CAP_SYS_ADMIN ))
18881888 goto out ;
18891889
1890- result = ERR_PTR ( - ENOENT ) ;
1890+ result = - ENOENT ;
18911891 task = get_proc_task (dir );
18921892 if (!task )
18931893 goto out ;
18941894
1895- result = ERR_PTR ( - EACCES ) ;
1895+ result = - EACCES ;
18961896 if (!ptrace_may_access (task , PTRACE_MODE_READ ))
18971897 goto out_put_task ;
18981898
1899- result = ERR_PTR ( - ENOENT ) ;
1899+ result = - ENOENT ;
19001900 if (dname_to_vma_addr (dentry , & vm_start , & vm_end ))
19011901 goto out_put_task ;
19021902
@@ -1919,7 +1919,7 @@ static struct dentry *proc_map_files_lookup(struct inode *dir,
19191919out_put_task :
19201920 put_task_struct (task );
19211921out :
1922- return result ;
1922+ return ERR_PTR ( result ) ;
19231923}
19241924
19251925static const struct inode_operations proc_map_files_inode_operations = {
@@ -2133,13 +2133,12 @@ static const struct file_operations proc_timers_operations = {
21332133};
21342134#endif /* CONFIG_CHECKPOINT_RESTORE */
21352135
2136- static struct dentry * proc_pident_instantiate (struct inode * dir ,
2136+ static int proc_pident_instantiate (struct inode * dir ,
21372137 struct dentry * dentry , struct task_struct * task , const void * ptr )
21382138{
21392139 const struct pid_entry * p = ptr ;
21402140 struct inode * inode ;
21412141 struct proc_inode * ei ;
2142- struct dentry * error = ERR_PTR (- ENOENT );
21432142
21442143 inode = proc_pid_make_inode (dir -> i_sb , task );
21452144 if (!inode )
@@ -2158,21 +2157,21 @@ static struct dentry *proc_pident_instantiate(struct inode *dir,
21582157 d_add (dentry , inode );
21592158 /* Close the race of the process dying before we return the dentry */
21602159 if (pid_revalidate (dentry , 0 ))
2161- error = NULL ;
2160+ return 0 ;
21622161out :
2163- return error ;
2162+ return - ENOENT ;
21642163}
21652164
21662165static struct dentry * proc_pident_lookup (struct inode * dir ,
21672166 struct dentry * dentry ,
21682167 const struct pid_entry * ents ,
21692168 unsigned int nents )
21702169{
2171- struct dentry * error ;
2170+ int error ;
21722171 struct task_struct * task = get_proc_task (dir );
21732172 const struct pid_entry * p , * last ;
21742173
2175- error = ERR_PTR ( - ENOENT ) ;
2174+ error = - ENOENT ;
21762175
21772176 if (!task )
21782177 goto out_no_task ;
@@ -2195,7 +2194,7 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
21952194out :
21962195 put_task_struct (task );
21972196out_no_task :
2198- return error ;
2197+ return ERR_PTR ( error ) ;
21992198}
22002199
22012200static int proc_pident_readdir (struct file * file , struct dir_context * ctx ,
@@ -2778,11 +2777,10 @@ void proc_flush_task(struct task_struct *task)
27782777 }
27792778}
27802779
2781- static struct dentry * proc_pid_instantiate (struct inode * dir ,
2782- struct dentry * dentry ,
2783- struct task_struct * task , const void * ptr )
2780+ static int proc_pid_instantiate (struct inode * dir ,
2781+ struct dentry * dentry ,
2782+ struct task_struct * task , const void * ptr )
27842783{
2785- struct dentry * error = ERR_PTR (- ENOENT );
27862784 struct inode * inode ;
27872785
27882786 inode = proc_pid_make_inode (dir -> i_sb , task );
@@ -2802,14 +2800,14 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
28022800 d_add (dentry , inode );
28032801 /* Close the race of the process dying before we return the dentry */
28042802 if (pid_revalidate (dentry , 0 ))
2805- error = NULL ;
2803+ return 0 ;
28062804out :
2807- return error ;
2805+ return - ENOENT ;
28082806}
28092807
28102808struct dentry * proc_pid_lookup (struct inode * dir , struct dentry * dentry , unsigned int flags )
28112809{
2812- struct dentry * result = NULL ;
2810+ int result = 0 ;
28132811 struct task_struct * task ;
28142812 unsigned tgid ;
28152813 struct pid_namespace * ns ;
@@ -2830,7 +2828,7 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsign
28302828 result = proc_pid_instantiate (dir , dentry , task , NULL );
28312829 put_task_struct (task );
28322830out :
2833- return result ;
2831+ return ERR_PTR ( result ) ;
28342832}
28352833
28362834/*
@@ -3025,10 +3023,9 @@ static const struct inode_operations proc_tid_base_inode_operations = {
30253023 .setattr = proc_setattr ,
30263024};
30273025
3028- static struct dentry * proc_task_instantiate (struct inode * dir ,
3026+ static int proc_task_instantiate (struct inode * dir ,
30293027 struct dentry * dentry , struct task_struct * task , const void * ptr )
30303028{
3031- struct dentry * error = ERR_PTR (- ENOENT );
30323029 struct inode * inode ;
30333030 inode = proc_pid_make_inode (dir -> i_sb , task );
30343031
@@ -3047,14 +3044,14 @@ static struct dentry *proc_task_instantiate(struct inode *dir,
30473044 d_add (dentry , inode );
30483045 /* Close the race of the process dying before we return the dentry */
30493046 if (pid_revalidate (dentry , 0 ))
3050- error = NULL ;
3047+ return 0 ;
30513048out :
3052- return error ;
3049+ return - ENOENT ;
30533050}
30543051
30553052static struct dentry * proc_task_lookup (struct inode * dir , struct dentry * dentry , unsigned int flags )
30563053{
3057- struct dentry * result = ERR_PTR ( - ENOENT ) ;
3054+ int result = - ENOENT ;
30583055 struct task_struct * task ;
30593056 struct task_struct * leader = get_proc_task (dir );
30603057 unsigned tid ;
@@ -3084,7 +3081,7 @@ static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry
30843081out :
30853082 put_task_struct (leader );
30863083out_no_task :
3087- return result ;
3084+ return ERR_PTR ( result ) ;
30883085}
30893086
30903087/*
0 commit comments