aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/fib_trie.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/fib_trie.c')
-rw-r--r--net/ipv4/fib_trie.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index be34bd556d58..81a8285d6d6a 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2379,25 +2379,8 @@ static const struct seq_operations fib_trie_seq_ops = {
2379 2379
2380static int fib_trie_seq_open(struct inode *inode, struct file *file) 2380static int fib_trie_seq_open(struct inode *inode, struct file *file)
2381{ 2381{
2382 struct seq_file *seq; 2382 return seq_open_private(file, &fib_trie_seq_ops,
2383 int rc = -ENOMEM; 2383 sizeof(struct fib_trie_iter));
2384 struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
2385
2386 if (!s)
2387 goto out;
2388
2389 rc = seq_open(file, &fib_trie_seq_ops);
2390 if (rc)
2391 goto out_kfree;
2392
2393 seq = file->private_data;
2394 seq->private = s;
2395 memset(s, 0, sizeof(*s));
2396out:
2397 return rc;
2398out_kfree:
2399 kfree(s);
2400 goto out;
2401} 2384}
2402 2385
2403static const struct file_operations fib_trie_fops = { 2386static const struct file_operations fib_trie_fops = {
@@ -2500,25 +2483,8 @@ static const struct seq_operations fib_route_seq_ops = {
2500 2483
2501static int fib_route_seq_open(struct inode *inode, struct file *file) 2484static int fib_route_seq_open(struct inode *inode, struct file *file)
2502{ 2485{
2503 struct seq_file *seq; 2486 return seq_open_private(file, &fib_route_seq_ops,
2504 int rc = -ENOMEM; 2487 sizeof(struct fib_trie_iter));
2505 struct fib_trie_iter *s = kmalloc(sizeof(*s), GFP_KERNEL);
2506
2507 if (!s)
2508 goto out;
2509
2510 rc = seq_open(file, &fib_route_seq_ops);
2511 if (rc)
2512 goto out_kfree;
2513
2514 seq = file->private_data;
2515 seq->private = s;
2516 memset(s, 0, sizeof(*s));
2517out:
2518 return rc;
2519out_kfree:
2520 kfree(s);
2521 goto out;
2522} 2488}
2523 2489
2524static const struct file_operations fib_route_fops = { 2490static const struct file_operations fib_route_fops = {