19
19
#include <linux/kmemleak.h>
20
20
#include "internal.h"
21
21
22
- #define list_for_each_table_entry (entry , table ) \
23
- for ((entry) = (table ); (entry)->procname; (entry)++)
22
+ #define list_for_each_table_entry (entry , header ) \
23
+ for ((entry) = (header->ctl_table ); (entry)->procname; (entry)++)
24
24
25
25
static const struct dentry_operations proc_sys_dentry_operations ;
26
26
static const struct file_operations proc_sys_file_operations ;
@@ -204,7 +204,7 @@ static void init_header(struct ctl_table_header *head,
204
204
if (node ) {
205
205
struct ctl_table * entry ;
206
206
207
- list_for_each_table_entry (entry , table ) {
207
+ list_for_each_table_entry (entry , head ) {
208
208
node -> header = head ;
209
209
node ++ ;
210
210
}
@@ -215,7 +215,7 @@ static void erase_header(struct ctl_table_header *head)
215
215
{
216
216
struct ctl_table * entry ;
217
217
218
- list_for_each_table_entry (entry , head -> ctl_table )
218
+ list_for_each_table_entry (entry , head )
219
219
erase_entry (head , entry );
220
220
}
221
221
@@ -242,7 +242,7 @@ static int insert_header(struct ctl_dir *dir, struct ctl_table_header *header)
242
242
err = insert_links (header );
243
243
if (err )
244
244
goto fail_links ;
245
- list_for_each_table_entry (entry , header -> ctl_table ) {
245
+ list_for_each_table_entry (entry , header ) {
246
246
err = insert_entry (header , entry );
247
247
if (err )
248
248
goto fail ;
@@ -1129,7 +1129,7 @@ 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 , header -> ctl_table ) {
1132
+ list_for_each_table_entry (entry , header ) {
1133
1133
if ((entry -> proc_handler == proc_dostring ) ||
1134
1134
(entry -> proc_handler == proc_dobool ) ||
1135
1135
(entry -> proc_handler == proc_dointvec ) ||
@@ -1169,7 +1169,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_
1169
1169
1170
1170
name_bytes = 0 ;
1171
1171
nr_entries = 0 ;
1172
- list_for_each_table_entry (entry , head -> ctl_table ) {
1172
+ list_for_each_table_entry (entry , head ) {
1173
1173
nr_entries ++ ;
1174
1174
name_bytes += strlen (entry -> procname ) + 1 ;
1175
1175
}
@@ -1188,7 +1188,7 @@ static struct ctl_table_header *new_links(struct ctl_dir *dir, struct ctl_table_
1188
1188
link_name = (char * )& link_table [nr_entries + 1 ];
1189
1189
link = link_table ;
1190
1190
1191
- list_for_each_table_entry (entry , head -> ctl_table ) {
1191
+ list_for_each_table_entry (entry , head ) {
1192
1192
int len = strlen (entry -> procname ) + 1 ;
1193
1193
memcpy (link_name , entry -> procname , len );
1194
1194
link -> procname = link_name ;
@@ -1211,7 +1211,7 @@ static bool get_links(struct ctl_dir *dir,
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 , header -> ctl_table ) {
1214
+ list_for_each_table_entry (entry , header ) {
1215
1215
const char * procname = entry -> procname ;
1216
1216
link = find_entry (& tmp_head , dir , procname , strlen (procname ));
1217
1217
if (!link )
@@ -1224,7 +1224,7 @@ 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 , header -> ctl_table ) {
1227
+ list_for_each_table_entry (entry , header ) {
1228
1228
const char * procname = entry -> procname ;
1229
1229
link = find_entry (& tmp_head , dir , procname , strlen (procname ));
1230
1230
tmp_head -> nreg ++ ;
@@ -1356,12 +1356,14 @@ struct ctl_table_header *__register_sysctl_table(
1356
1356
{
1357
1357
struct ctl_table_root * root = set -> dir .header .root ;
1358
1358
struct ctl_table_header * header ;
1359
+ struct ctl_table_header h_tmp ;
1359
1360
struct ctl_dir * dir ;
1360
1361
struct ctl_table * entry ;
1361
1362
struct ctl_node * node ;
1362
1363
int nr_entries = 0 ;
1363
1364
1364
- list_for_each_table_entry (entry , table )
1365
+ h_tmp .ctl_table = table ;
1366
+ list_for_each_table_entry (entry , (& h_tmp ))
1365
1367
nr_entries ++ ;
1366
1368
1367
1369
header = kzalloc (sizeof (struct ctl_table_header ) +
@@ -1471,7 +1473,7 @@ static void put_links(struct ctl_table_header *header)
1471
1473
if (IS_ERR (core_parent ))
1472
1474
return ;
1473
1475
1474
- list_for_each_table_entry (entry , header -> ctl_table ) {
1476
+ list_for_each_table_entry (entry , header ) {
1475
1477
struct ctl_table_header * link_head ;
1476
1478
struct ctl_table * link ;
1477
1479
const char * name = entry -> procname ;
0 commit comments