Messages in this thread | | | From | Matthew Garrett <> | Date | Wed, 26 Jun 2019 12:39:31 -0700 | Subject | Re: [PATCH V33 29/30] tracefs: Restrict tracefs when the kernel is locked down |
| |
On Wed, Jun 26, 2019 at 6:07 AM Steven Rostedt <rostedt@goodmis.org> wrote: > > On Thu, 20 Jun 2019 18:19:40 -0700 > Matthew Garrett <matthewgarrett@google.com> wrote: > > +static const struct file_operations tracefs_proxy_file_operations = { > > + .read = default_read_file, > > + .write = default_write_file, > > + .open = default_open_file, > > + .llseek = noop_llseek, > > +}; > > This appears to be unused.
Oops, yup - dropped.
> > + dentry->d_fsdata = fops ? (void *)fops : > > + (void *)&tracefs_file_operations; > > + memcpy(proxy_fops, dentry->d_fsdata, sizeof(struct file_operations)); > > + proxy_fops->open = default_open_file; > > inode->i_mode = mode; > > - inode->i_fop = fops ? fops : &tracefs_file_operations; > > + inode->i_fop = proxy_fops; > > > I think the above would look cleaner as: > > > if (!fops) > fops = &tracefs_file_operations; > > dentry->d_fsdata = (void *)fops; > memcpy(proxy_fops, fops, sizeof(*proxy_fops); > proxy_fops->open = default_open_file;
ACK.
| |