* [PATCH] Fixed the build warning in init_trace_printk_function_export():
@ 2025-09-07 14:07 Fidal Palamparambil
2025-09-07 17:01 ` kernel test robot
2025-09-07 18:33 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Fidal Palamparambil @ 2025-09-07 14:07 UTC (permalink / raw)
To: linux-modules
Cc: mcgrof, petr.pavlu, da.gomez, samitolvanen, linux-kernel,
Fidal palamparambil
From: Fidal palamparambil <rootuserhere@gmail.com>
Changed int ret to struct dentry *dentry
Changed if (ret) to if (IS_ERR_OR_NULL(dentry))
Fixed memory leak in hold_module_trace_bprintk_format():
Added proper cleanup when fmt allocation fails
Set tb_fmt = NULL after freeing to prevent dangling pointers
Fixed NULL pointer dereference in t_show():
Added if (!fmt || !*fmt) check before dereferencing
Simplified the string iteration loop
Added NULL check in trace_is_tracepoint_string():
Added if (!str) check to prevent NULL pointer dereference
Fixed type safety in t_show():
Changed *(unsigned long *)fmt to (unsigned long)fmt for correct pointer casting
Fixed function signature in ftrace_formats_open():
Changed struct file *file to const struct file *file for consistency
Signed-off-by: Fidal palamparambil <rootuserhere@gmail.com>
---
kernel/trace/trace_printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index 665effbf50ae..060bd2c35a7d 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -363,7 +363,7 @@ static const struct seq_operations show_format_seq_ops = {
};
static int
-ftrace_formats_open(struct inode *inode, struct file *file)
+ftrace_formats_open(struct inode *inode, const struct file *file)
{
int ret;
--
2.50.1.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fixed the build warning in init_trace_printk_function_export():
2025-09-07 14:07 [PATCH] Fixed the build warning in init_trace_printk_function_export(): Fidal Palamparambil
@ 2025-09-07 17:01 ` kernel test robot
2025-09-07 18:33 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-09-07 17:01 UTC (permalink / raw)
To: Fidal Palamparambil, linux-modules
Cc: oe-kbuild-all, mcgrof, petr.pavlu, da.gomez, samitolvanen,
linux-kernel, Fidal palamparambil
Hi Fidal,
kernel test robot noticed the following build warnings:
[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v6.17-rc4 next-20250905]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Fidal-Palamparambil/Fixed-the-build-warning-in-init_trace_printk_function_export/20250907-221041
base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link: https://lore.kernel.org/r/20250907140755.529-1-rootuserhere%40gmail.com
patch subject: [PATCH] Fixed the build warning in init_trace_printk_function_export():
config: x86_64-buildonly-randconfig-001-20250907 (https://download.01.org/0day-ci/archive/20250908/202509080040.8gEyq9Ef-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250908/202509080040.8gEyq9Ef-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509080040.8gEyq9Ef-lkp@intel.com/
All warnings (new ones prefixed by >>):
kernel/trace/trace_printk.c: In function 'ftrace_formats_open':
>> kernel/trace/trace_printk.c:369:25: warning: passing argument 1 of 'seq_open' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
369 | return seq_open(file, &show_format_seq_ops);
| ^~~~
In file included from kernel/trace/trace_printk.c:8:
include/linux/seq_file.h:108:14: note: expected 'struct file *' but argument is of type 'const struct file *'
108 | int seq_open(struct file *, const struct seq_operations *);
| ^~~~~~~~~~~~~
kernel/trace/trace_printk.c: At top level:
kernel/trace/trace_printk.c:373:17: error: initialization of 'int (*)(struct inode *, struct file *)' from incompatible pointer type 'int (*)(struct inode *, const struct file *)' [-Werror=incompatible-pointer-types]
373 | .open = ftrace_formats_open,
| ^~~~~~~~~~~~~~~~~~~
kernel/trace/trace_printk.c:373:17: note: (near initialization for 'ftrace_formats_fops.open')
cc1: some warnings being treated as errors
vim +369 kernel/trace/trace_printk.c
7975a2be16dd42 Steven Rostedt 2009-03-12 359
7975a2be16dd42 Steven Rostedt 2009-03-12 360 static int
66670b02cb828c Fidal palamparambil 2025-09-07 361 ftrace_formats_open(struct inode *inode, const struct file *file)
7975a2be16dd42 Steven Rostedt 2009-03-12 362 {
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 363) int ret;
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 364)
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 365) ret = security_locked_down(LOCKDOWN_TRACEFS);
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 366) if (ret)
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 367) return ret;
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 368)
c8961ec6da22ea Li Zefan 2009-06-24 @369 return seq_open(file, &show_format_seq_ops);
7975a2be16dd42 Steven Rostedt 2009-03-12 370 }
7975a2be16dd42 Steven Rostedt 2009-03-12 371
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fixed the build warning in init_trace_printk_function_export():
2025-09-07 14:07 [PATCH] Fixed the build warning in init_trace_printk_function_export(): Fidal Palamparambil
2025-09-07 17:01 ` kernel test robot
@ 2025-09-07 18:33 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-09-07 18:33 UTC (permalink / raw)
To: Fidal Palamparambil, linux-modules
Cc: llvm, oe-kbuild-all, mcgrof, petr.pavlu, da.gomez, samitolvanen,
linux-kernel, Fidal palamparambil
Hi Fidal,
kernel test robot noticed the following build errors:
[auto build test ERROR on trace/for-next]
[also build test ERROR on linus/master v6.17-rc4 next-20250905]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Fidal-Palamparambil/Fixed-the-build-warning-in-init_trace_printk_function_export/20250907-221041
base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link: https://lore.kernel.org/r/20250907140755.529-1-rootuserhere%40gmail.com
patch subject: [PATCH] Fixed the build warning in init_trace_printk_function_export():
config: x86_64-buildonly-randconfig-002-20250907 (https://download.01.org/0day-ci/archive/20250908/202509080203.SxCdQOOY-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250908/202509080203.SxCdQOOY-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509080203.SxCdQOOY-lkp@intel.com/
All errors (new ones prefixed by >>):
>> kernel/trace/trace_printk.c:369:18: error: passing 'const struct file *' to parameter of type 'struct file *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
369 | return seq_open(file, &show_format_seq_ops);
| ^~~~
include/linux/seq_file.h:108:27: note: passing argument to parameter here
108 | int seq_open(struct file *, const struct seq_operations *);
| ^
>> kernel/trace/trace_printk.c:373:10: error: incompatible function pointer types initializing 'int (*)(struct inode *, struct file *)' with an expression of type 'int (struct inode *, const struct file *)' [-Wincompatible-function-pointer-types]
373 | .open = ftrace_formats_open,
| ^~~~~~~~~~~~~~~~~~~
2 errors generated.
vim +369 kernel/trace/trace_printk.c
7975a2be16dd42 Steven Rostedt 2009-03-12 359
7975a2be16dd42 Steven Rostedt 2009-03-12 360 static int
66670b02cb828c Fidal palamparambil 2025-09-07 361 ftrace_formats_open(struct inode *inode, const struct file *file)
7975a2be16dd42 Steven Rostedt 2009-03-12 362 {
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 363) int ret;
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 364)
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 365) ret = security_locked_down(LOCKDOWN_TRACEFS);
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 366) if (ret)
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 367) return ret;
17911ff38aa58d Steven Rostedt (VMware 2019-10-11 368)
c8961ec6da22ea Li Zefan 2009-06-24 @369 return seq_open(file, &show_format_seq_ops);
7975a2be16dd42 Steven Rostedt 2009-03-12 370 }
7975a2be16dd42 Steven Rostedt 2009-03-12 371
7975a2be16dd42 Steven Rostedt 2009-03-12 372 static const struct file_operations ftrace_formats_fops = {
7975a2be16dd42 Steven Rostedt 2009-03-12 @373 .open = ftrace_formats_open,
7975a2be16dd42 Steven Rostedt 2009-03-12 374 .read = seq_read,
7975a2be16dd42 Steven Rostedt 2009-03-12 375 .llseek = seq_lseek,
7975a2be16dd42 Steven Rostedt 2009-03-12 376 .release = seq_release,
7975a2be16dd42 Steven Rostedt 2009-03-12 377 };
7975a2be16dd42 Steven Rostedt 2009-03-12 378
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-07 18:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-07 14:07 [PATCH] Fixed the build warning in init_trace_printk_function_export(): Fidal Palamparambil
2025-09-07 17:01 ` kernel test robot
2025-09-07 18:33 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).