@@ -1125,11 +1125,11 @@ static int sysctl_check_table_array(const char *path, struct ctl_table *table)
11251125 return err ;
11261126}
11271127
1128- static int sysctl_check_table (const char * path , struct ctl_table * table )
1128+ static int sysctl_check_table (const char * path , struct ctl_table_header * header )
11291129{
11301130 struct ctl_table * entry ;
11311131 int err = 0 ;
1132- list_for_each_table_entry (entry , table ) {
1132+ list_for_each_table_entry (entry , header -> ctl_table ) {
11331133 if ((entry -> proc_handler == proc_dostring ) ||
11341134 (entry -> proc_handler == proc_dobool ) ||
11351135 (entry -> proc_handler == proc_dointvec ) ||
@@ -1159,8 +1159,7 @@ static int sysctl_check_table(const char *path, struct ctl_table *table)
11591159 return err ;
11601160}
11611161
1162- static struct ctl_table_header * new_links (struct ctl_dir * dir , struct ctl_table * table ,
1163- struct ctl_table_root * link_root )
1162+ static struct ctl_table_header * new_links (struct ctl_dir * dir , struct ctl_table_header * head )
11641163{
11651164 struct ctl_table * link_table , * entry , * link ;
11661165 struct ctl_table_header * links ;
@@ -1170,7 +1169,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table
11701169
11711170 name_bytes = 0 ;
11721171 nr_entries = 0 ;
1173- list_for_each_table_entry (entry , table ) {
1172+ list_for_each_table_entry (entry , head -> ctl_table ) {
11741173 nr_entries ++ ;
11751174 name_bytes += strlen (entry -> procname ) + 1 ;
11761175 }
@@ -1189,12 +1188,12 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table
11891188 link_name = (char * )& link_table [nr_entries + 1 ];
11901189 link = link_table ;
11911190
1192- list_for_each_table_entry (entry , table ) {
1191+ list_for_each_table_entry (entry , head -> ctl_table ) {
11931192 int len = strlen (entry -> procname ) + 1 ;
11941193 memcpy (link_name , entry -> procname , len );
11951194 link -> procname = link_name ;
11961195 link -> mode = S_IFLNK |S_IRWXUGO ;
1197- link -> data = link_root ;
1196+ link -> data = head -> root ;
11981197 link_name += len ;
11991198 link ++ ;
12001199 }
@@ -1205,15 +1204,16 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table
12051204}
12061205
12071206static bool get_links (struct ctl_dir * dir ,
1208- struct ctl_table * table , struct ctl_table_root * link_root )
1207+ struct ctl_table_header * header ,
1208+ struct ctl_table_root * link_root )
12091209{
1210- struct ctl_table_header * head ;
1210+ struct ctl_table_header * tmp_head ;
12111211 struct ctl_table * entry , * link ;
12121212
12131213 /* Are there links available for every entry in table? */
1214- list_for_each_table_entry (entry , table ) {
1214+ list_for_each_table_entry (entry , header -> ctl_table ) {
12151215 const char * procname = entry -> procname ;
1216- link = find_entry (& head , dir , procname , strlen (procname ));
1216+ link = find_entry (& tmp_head , dir , procname , strlen (procname ));
12171217 if (!link )
12181218 return false;
12191219 if (S_ISDIR (link -> mode ) && S_ISDIR (entry -> mode ))
@@ -1224,10 +1224,10 @@ static bool get_links(struct ctl_dir *dir,
12241224 }
12251225
12261226 /* The checks passed. Increase the registration count on the links */
1227- list_for_each_table_entry (entry , table ) {
1227+ list_for_each_table_entry (entry , header -> ctl_table ) {
12281228 const char * procname = entry -> procname ;
1229- link = find_entry (& head , dir , procname , strlen (procname ));
1230- head -> nreg ++ ;
1229+ link = find_entry (& tmp_head , dir , procname , strlen (procname ));
1230+ tmp_head -> nreg ++ ;
12311231 }
12321232 return true;
12331233}
@@ -1246,21 +1246,21 @@ static int insert_links(struct ctl_table_header *head)
12461246 if (IS_ERR (core_parent ))
12471247 return 0 ;
12481248
1249- if (get_links (core_parent , head -> ctl_table , head -> root ))
1249+ if (get_links (core_parent , head , head -> root ))
12501250 return 0 ;
12511251
12521252 core_parent -> header .nreg ++ ;
12531253 spin_unlock (& sysctl_lock );
12541254
1255- links = new_links (core_parent , head -> ctl_table , head -> root );
1255+ links = new_links (core_parent , head );
12561256
12571257 spin_lock (& sysctl_lock );
12581258 err = - ENOMEM ;
12591259 if (!links )
12601260 goto out ;
12611261
12621262 err = 0 ;
1263- if (get_links (core_parent , head -> ctl_table , head -> root )) {
1263+ if (get_links (core_parent , head , head -> root )) {
12641264 kfree (links );
12651265 goto out ;
12661266 }
@@ -1371,7 +1371,7 @@ struct ctl_table_header *__register_sysctl_table(
13711371
13721372 node = (struct ctl_node * )(header + 1 );
13731373 init_header (header , root , set , node , table );
1374- if (sysctl_check_table (path , table ))
1374+ if (sysctl_check_table (path , header ))
13751375 goto fail ;
13761376
13771377 spin_lock (& sysctl_lock );
0 commit comments