|
@@ -269,20 +269,13 @@ static int maps_open(struct inode *inode, struct file *file,
|
|
|
const struct seq_operations *ops)
|
|
|
{
|
|
|
struct proc_maps_private *priv;
|
|
|
- int ret = -ENOMEM;
|
|
|
-
|
|
|
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
|
|
- if (priv) {
|
|
|
- priv->pid = proc_pid(inode);
|
|
|
- ret = seq_open(file, ops);
|
|
|
- if (!ret) {
|
|
|
- struct seq_file *m = file->private_data;
|
|
|
- m->private = priv;
|
|
|
- } else {
|
|
|
- kfree(priv);
|
|
|
- }
|
|
|
- }
|
|
|
- return ret;
|
|
|
+
|
|
|
+ priv = __seq_open_private(file, ops, sizeof(struct proc_maps_private));
|
|
|
+ if (!priv)
|
|
|
+ return -ENOMEM;
|
|
|
+
|
|
|
+ priv->pid = proc_pid(inode);
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
static int pid_maps_open(struct inode *inode, struct file *file)
|