Server IP : 15.235.198.142 / Your IP : 216.73.216.203 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/src/linux-headers-6.8.0-45/scripts/coccinelle/api/ |
Upload File : |
// SPDX-License-Identifier: GPL-2.0 /// Remove an open coded simple_open() function /// and replace file operations references to the function /// with simple_open() instead. /// // Confidence: High // Comments: // Options: --no-includes --include-headers virtual patch virtual report @ open depends on patch @ identifier open_f != simple_open; identifier i, f; @@ -int open_f(struct inode *i, struct file *f) -{ ( -if (i->i_private) -f->private_data = i->i_private; | -f->private_data = i->i_private; ) -return 0; -} @ has_open depends on open @ identifier fops; identifier open.open_f; @@ struct file_operations fops = { ..., -.open = open_f, +.open = simple_open, ... }; @ openr depends on report @ identifier open_f != simple_open; identifier i, f; position p; @@ int open_f@p(struct inode *i, struct file *f) { ( if (i->i_private) f->private_data = i->i_private; | f->private_data = i->i_private; ) return 0; } @ has_openr depends on openr @ identifier fops; identifier openr.open_f; position p; @@ struct file_operations fops = { ..., .open = open_f@p, ... }; @script:python@ pf << openr.p; ps << has_openr.p; @@ coccilib.report.print_report(pf[0],"WARNING opportunity for simple_open, see also structure on line %s"%(ps[0].line))