@@ -1125,11 +1125,11 @@ static int sysctl_check_table_array(const char *path, struct ctl_table *table)
1125
1125
return err ;
1126
1126
}
1127
1127
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 )
1129
1129
{
1130
1130
struct ctl_table * entry ;
1131
1131
int err = 0 ;
1132
- list_for_each_table_entry (entry , table ) {
1132
+ list_for_each_table_entry (entry , header -> ctl_table ) {
1133
1133
if ((entry -> proc_handler == proc_dostring ) ||
1134
1134
(entry -> proc_handler == proc_dobool ) ||
1135
1135
(entry -> proc_handler == proc_dointvec ) ||
@@ -1159,8 +1159,7 @@ static int sysctl_check_table(const char *path, struct ctl_table *table)
1159
1159
return err ;
1160
1160
}
1161
1161
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 )
1164
1163
{
1165
1164
struct ctl_table * link_table , * entry , * link ;
1166
1165
struct ctl_table_header * links ;
@@ -1170,7 +1169,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table
1170
1169
1171
1170
name_bytes = 0 ;
1172
1171
nr_entries = 0 ;
1173
- list_for_each_table_entry (entry , table ) {
1172
+ list_for_each_table_entry (entry , head -> ctl_table ) {
1174
1173
nr_entries ++ ;
1175
1174
name_bytes += strlen (entry -> procname ) + 1 ;
1176
1175
}
@@ -1189,12 +1188,12 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table
1189
1188
link_name = (char * )& link_table [nr_entries + 1 ];
1190
1189
link = link_table ;
1191
1190
1192
- list_for_each_table_entry (entry , table ) {
1191
+ list_for_each_table_entry (entry , head -> ctl_table ) {
1193
1192
int len = strlen (entry -> procname ) + 1 ;
1194
1193
memcpy (link_name , entry -> procname , len );
1195
1194
link -> procname = link_name ;
1196
1195
link -> mode = S_IFLNK |S_IRWXUGO ;
1197
- link -> data = link_root ;
1196
+ link -> data = head -> root ;
1198
1197
link_name += len ;
1199
1198
link ++ ;
1200
1199
}
@@ -1205,15 +1204,16 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table
1205
1204
}
1206
1205
1207
1206
static 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 )
1209
1209
{
1210
- struct ctl_table_header * head ;
1210
+ struct ctl_table_header * tmp_head ;
1211
1211
struct ctl_table * entry , * link ;
1212
1212
1213
1213
/* 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 ) {
1215
1215
const char * procname = entry -> procname ;
1216
- link = find_entry (& head , dir , procname , strlen (procname ));
1216
+ link = find_entry (& tmp_head , dir , procname , strlen (procname ));
1217
1217
if (!link )
1218
1218
return false;
1219
1219
if (S_ISDIR (link -> mode ) && S_ISDIR (entry -> mode ))
@@ -1224,10 +1224,10 @@ static bool get_links(struct ctl_dir *dir,
1224
1224
}
1225
1225
1226
1226
/* 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 ) {
1228
1228
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 ++ ;
1231
1231
}
1232
1232
return true;
1233
1233
}
@@ -1246,21 +1246,21 @@ static int insert_links(struct ctl_table_header *head)
1246
1246
if (IS_ERR (core_parent ))
1247
1247
return 0 ;
1248
1248
1249
- if (get_links (core_parent , head -> ctl_table , head -> root ))
1249
+ if (get_links (core_parent , head , head -> root ))
1250
1250
return 0 ;
1251
1251
1252
1252
core_parent -> header .nreg ++ ;
1253
1253
spin_unlock (& sysctl_lock );
1254
1254
1255
- links = new_links (core_parent , head -> ctl_table , head -> root );
1255
+ links = new_links (core_parent , head );
1256
1256
1257
1257
spin_lock (& sysctl_lock );
1258
1258
err = - ENOMEM ;
1259
1259
if (!links )
1260
1260
goto out ;
1261
1261
1262
1262
err = 0 ;
1263
- if (get_links (core_parent , head -> ctl_table , head -> root )) {
1263
+ if (get_links (core_parent , head , head -> root )) {
1264
1264
kfree (links );
1265
1265
goto out ;
1266
1266
}
@@ -1371,7 +1371,7 @@ struct ctl_table_header *__register_sysctl_table(
1371
1371
1372
1372
node = (struct ctl_node * )(header + 1 );
1373
1373
init_header (header , root , set , node , table );
1374
- if (sysctl_check_table (path , table ))
1374
+ if (sysctl_check_table (path , header ))
1375
1375
goto fail ;
1376
1376
1377
1377
spin_lock (& sysctl_lock );
0 commit comments