Re: drivers/firmware/arm_scmi/raw_mode.c:924:8-24: WARNING: scmi_dbg_raw_mode_reset_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open. (fwd)
From: Cristian Marussi
Date: Mon Oct 14 2024 - 06:25:18 EST
On Wed, Oct 02, 2024 at 09:36:51AM +0200, Julia Lawall wrote:
> Hello,
>
> I'm just forwarding this for your consideration. I don't know about this
> issue.
>
Hi Julia,
thanks for letting me know and sorry for the delay in this answer...
...I'll have a look at this soon(-ish)
Thanks,
Cristian
> julia
>
> ---------- Forwarded message ----------
> Date: Wed, 2 Oct 2024 05:16:38 +0800
> From: kernel test robot <lkp@xxxxxxxxx>
> To: oe-kbuild@xxxxxxxxxxxxxxx
> Cc: lkp@xxxxxxxxx, Julia Lawall <julia.lawall@xxxxxxxx>
> Subject: drivers/firmware/arm_scmi/raw_mode.c:924:8-24: WARNING:
> scmi_dbg_raw_mode_reset_fops: .write() has stream semantic; safe to change
> nonseekable_open -> stream_open.
>
> BCC: lkp@xxxxxxxxx
> CC: oe-kbuild-all@xxxxxxxxxxxxxxx
> CC: linux-kernel@xxxxxxxxxxxxxxx
> TO: Cristian Marussi <cristian.marussi@xxxxxxx>
> CC: Sudeep Holla <sudeep.holla@xxxxxxx>
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: e32cde8d2bd7d251a8f9b434143977ddf13dcec6
> commit: b70c7996d4ffb2e02895132e8a79a37cee66504f firmware: arm_scmi: Make raw debugfs entries non-seekable
> date: 6 months ago
> :::::: branch date: 25 hours ago
> :::::: commit date: 6 months ago
> config: arm64-randconfig-r053-20241001 (https://download.01.org/0day-ci/archive/20241002/202410020543.MuCto6Eo-lkp@xxxxxxxxx/config)
> compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 7773243d9916f98ba0ffce0c3a960e4aa9f03e81)
>
> 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@xxxxxxxxx>
> | Reported-by: Julia Lawall <julia.lawall@xxxxxxxx>
> | Closes: https://lore.kernel.org/r/202410020543.MuCto6Eo-lkp@xxxxxxxxx/
>
> cocci warnings: (new ones prefixed by >>)
> >> drivers/firmware/arm_scmi/raw_mode.c:924:8-24: WARNING: scmi_dbg_raw_mode_reset_fops: .write() has stream semantic; safe to change nonseekable_open -> stream_open.
>
> vim +924 drivers/firmware/arm_scmi/raw_mode.c
>
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 886
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 887 static int scmi_dbg_raw_mode_open(struct inode *inode, struct file *filp)
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 888 {
> 7860701d1e6e6e Cristian Marussi 2023-01-18 889 u8 id;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 890 struct scmi_raw_mode_info *raw;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 891 struct scmi_dbg_raw_data *rd;
> 7860701d1e6e6e Cristian Marussi 2023-01-18 892 const char *id_str = filp->f_path.dentry->d_parent->d_name.name;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 893
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 894 if (!inode->i_private)
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 895 return -ENODEV;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 896
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 897 raw = inode->i_private;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 898 rd = kzalloc(sizeof(*rd), GFP_KERNEL);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 899 if (!rd)
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 900 return -ENOMEM;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 901
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 902 rd->rx.len = raw->desc->max_msg_size + sizeof(u32);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 903 rd->rx.buf = kzalloc(rd->rx.len, GFP_KERNEL);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 904 if (!rd->rx.buf) {
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 905 kfree(rd);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 906 return -ENOMEM;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 907 }
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 908
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 909 rd->tx.len = raw->desc->max_msg_size + sizeof(u32);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 910 rd->tx.buf = kzalloc(rd->tx.len, GFP_KERNEL);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 911 if (!rd->tx.buf) {
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 912 kfree(rd->rx.buf);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 913 kfree(rd);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 914 return -ENOMEM;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 915 }
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 916
> 7860701d1e6e6e Cristian Marussi 2023-01-18 917 /* Grab channel ID from debugfs entry naming if any */
> 7860701d1e6e6e Cristian Marussi 2023-01-18 918 if (!kstrtou8(id_str, 16, &id))
> 7860701d1e6e6e Cristian Marussi 2023-01-18 919 rd->chan_id = id;
> 7860701d1e6e6e Cristian Marussi 2023-01-18 920
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 921 rd->raw = raw;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 922 filp->private_data = rd;
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 923
> b70c7996d4ffb2 Cristian Marussi 2024-03-15 @924 return nonseekable_open(inode, filp);
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 925 }
> 3c3d818a9317a5 Cristian Marussi 2023-01-18 926
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki