From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [axboe-block:rw_iter 138/448] drivers/gpu/drm/i915/display/intel_hotplug.c:1040 i915_hpd_storm_ctl_write() warn: potential spectre issue 'tmp' [w]
Date: Sun, 22 Sep 2024 23:17:02 +0800 [thread overview]
Message-ID: <202409222356.Id5VC2Ol-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Jens Axboe <axboe@kernel.dk>
Hi Jens,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git rw_iter
head: 7ef9d29ff0268d9fb68e3b1bf7548981d7a61307
commit: fb267b131a04cfdc7c70d3f067b7f8545ca8b4f3 [138/448] drm/i915: convert to read/write iterators
:::::: branch date: 8 hours ago
:::::: commit date: 2 days ago
config: i386-randconfig-141-20240922 (https://download.01.org/0day-ci/archive/20240922/202409222356.Id5VC2Ol-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202409222356.Id5VC2Ol-lkp@intel.com/
smatch warnings:
drivers/gpu/drm/i915/display/intel_hotplug.c:1040 i915_hpd_storm_ctl_write() warn: potential spectre issue 'tmp' [w]
drivers/gpu/drm/i915/display/intel_hotplug.c:1121 i915_hpd_short_storm_ctl_write() warn: potential spectre issue 'tmp' [w]
drivers/gpu/drm/i915/display/intel_wm.c:305 wm_latency_write() warn: potential spectre issue 'tmp' [w]
vim +/tmp +1040 drivers/gpu/drm/i915/display/intel_hotplug.c
1bed8b07342069 Jani Nikula 2022-09-16 1021
fb267b131a04cf Jens Axboe 2024-04-09 1022 static ssize_t i915_hpd_storm_ctl_write(struct kiocb *iocb,
fb267b131a04cf Jens Axboe 2024-04-09 1023 struct iov_iter *from)
1bed8b07342069 Jani Nikula 2022-09-16 1024 {
fb267b131a04cf Jens Axboe 2024-04-09 1025 struct seq_file *m = iocb->ki_filp->private_data;
1bed8b07342069 Jani Nikula 2022-09-16 1026 struct drm_i915_private *dev_priv = m->private;
1bed8b07342069 Jani Nikula 2022-09-16 1027 struct intel_hotplug *hotplug = &dev_priv->display.hotplug;
fb267b131a04cf Jens Axboe 2024-04-09 1028 size_t len = iov_iter_count(from);
1bed8b07342069 Jani Nikula 2022-09-16 1029 unsigned int new_threshold;
1bed8b07342069 Jani Nikula 2022-09-16 1030 int i;
1bed8b07342069 Jani Nikula 2022-09-16 1031 char *newline;
1bed8b07342069 Jani Nikula 2022-09-16 1032 char tmp[16];
1bed8b07342069 Jani Nikula 2022-09-16 1033
1bed8b07342069 Jani Nikula 2022-09-16 1034 if (len >= sizeof(tmp))
1bed8b07342069 Jani Nikula 2022-09-16 1035 return -EINVAL;
1bed8b07342069 Jani Nikula 2022-09-16 1036
fb267b131a04cf Jens Axboe 2024-04-09 1037 if (!copy_from_iter_full(tmp, len, from))
1bed8b07342069 Jani Nikula 2022-09-16 1038 return -EFAULT;
1bed8b07342069 Jani Nikula 2022-09-16 1039
1bed8b07342069 Jani Nikula 2022-09-16 @1040 tmp[len] = '\0';
1bed8b07342069 Jani Nikula 2022-09-16 1041
1bed8b07342069 Jani Nikula 2022-09-16 1042 /* Strip newline, if any */
1bed8b07342069 Jani Nikula 2022-09-16 1043 newline = strchr(tmp, '\n');
1bed8b07342069 Jani Nikula 2022-09-16 1044 if (newline)
1bed8b07342069 Jani Nikula 2022-09-16 1045 *newline = '\0';
1bed8b07342069 Jani Nikula 2022-09-16 1046
1bed8b07342069 Jani Nikula 2022-09-16 1047 if (strcmp(tmp, "reset") == 0)
1bed8b07342069 Jani Nikula 2022-09-16 1048 new_threshold = HPD_STORM_DEFAULT_THRESHOLD;
1bed8b07342069 Jani Nikula 2022-09-16 1049 else if (kstrtouint(tmp, 10, &new_threshold) != 0)
1bed8b07342069 Jani Nikula 2022-09-16 1050 return -EINVAL;
1bed8b07342069 Jani Nikula 2022-09-16 1051
1bed8b07342069 Jani Nikula 2022-09-16 1052 if (new_threshold > 0)
1bed8b07342069 Jani Nikula 2022-09-16 1053 drm_dbg_kms(&dev_priv->drm,
1bed8b07342069 Jani Nikula 2022-09-16 1054 "Setting HPD storm detection threshold to %d\n",
1bed8b07342069 Jani Nikula 2022-09-16 1055 new_threshold);
1bed8b07342069 Jani Nikula 2022-09-16 1056 else
1bed8b07342069 Jani Nikula 2022-09-16 1057 drm_dbg_kms(&dev_priv->drm, "Disabling HPD storm detection\n");
1bed8b07342069 Jani Nikula 2022-09-16 1058
1bed8b07342069 Jani Nikula 2022-09-16 1059 spin_lock_irq(&dev_priv->irq_lock);
1bed8b07342069 Jani Nikula 2022-09-16 1060 hotplug->hpd_storm_threshold = new_threshold;
1bed8b07342069 Jani Nikula 2022-09-16 1061 /* Reset the HPD storm stats so we don't accidentally trigger a storm */
1bed8b07342069 Jani Nikula 2022-09-16 1062 for_each_hpd_pin(i)
1bed8b07342069 Jani Nikula 2022-09-16 1063 hotplug->stats[i].count = 0;
1bed8b07342069 Jani Nikula 2022-09-16 1064 spin_unlock_irq(&dev_priv->irq_lock);
1bed8b07342069 Jani Nikula 2022-09-16 1065
1bed8b07342069 Jani Nikula 2022-09-16 1066 /* Re-enable hpd immediately if we were in an irq storm */
1bed8b07342069 Jani Nikula 2022-09-16 1067 flush_delayed_work(&dev_priv->display.hotplug.reenable_work);
1bed8b07342069 Jani Nikula 2022-09-16 1068
1bed8b07342069 Jani Nikula 2022-09-16 1069 return len;
1bed8b07342069 Jani Nikula 2022-09-16 1070 }
1bed8b07342069 Jani Nikula 2022-09-16 1071
1bed8b07342069 Jani Nikula 2022-09-16 1072 static int i915_hpd_storm_ctl_open(struct inode *inode, struct file *file)
1bed8b07342069 Jani Nikula 2022-09-16 1073 {
1bed8b07342069 Jani Nikula 2022-09-16 1074 return single_open(file, i915_hpd_storm_ctl_show, inode->i_private);
1bed8b07342069 Jani Nikula 2022-09-16 1075 }
1bed8b07342069 Jani Nikula 2022-09-16 1076
1bed8b07342069 Jani Nikula 2022-09-16 1077 static const struct file_operations i915_hpd_storm_ctl_fops = {
1bed8b07342069 Jani Nikula 2022-09-16 1078 .owner = THIS_MODULE,
1bed8b07342069 Jani Nikula 2022-09-16 1079 .open = i915_hpd_storm_ctl_open,
fb267b131a04cf Jens Axboe 2024-04-09 1080 .read_iter = seq_read_iter,
1bed8b07342069 Jani Nikula 2022-09-16 1081 .llseek = seq_lseek,
1bed8b07342069 Jani Nikula 2022-09-16 1082 .release = single_release,
fb267b131a04cf Jens Axboe 2024-04-09 1083 .write_iter = i915_hpd_storm_ctl_write
1bed8b07342069 Jani Nikula 2022-09-16 1084 };
1bed8b07342069 Jani Nikula 2022-09-16 1085
1bed8b07342069 Jani Nikula 2022-09-16 1086 static int i915_hpd_short_storm_ctl_show(struct seq_file *m, void *data)
1bed8b07342069 Jani Nikula 2022-09-16 1087 {
1bed8b07342069 Jani Nikula 2022-09-16 1088 struct drm_i915_private *dev_priv = m->private;
1bed8b07342069 Jani Nikula 2022-09-16 1089
1bed8b07342069 Jani Nikula 2022-09-16 1090 seq_printf(m, "Enabled: %s\n",
1bed8b07342069 Jani Nikula 2022-09-16 1091 str_yes_no(dev_priv->display.hotplug.hpd_short_storm_enabled));
1bed8b07342069 Jani Nikula 2022-09-16 1092
1bed8b07342069 Jani Nikula 2022-09-16 1093 return 0;
1bed8b07342069 Jani Nikula 2022-09-16 1094 }
1bed8b07342069 Jani Nikula 2022-09-16 1095
1bed8b07342069 Jani Nikula 2022-09-16 1096 static int
1bed8b07342069 Jani Nikula 2022-09-16 1097 i915_hpd_short_storm_ctl_open(struct inode *inode, struct file *file)
1bed8b07342069 Jani Nikula 2022-09-16 1098 {
1bed8b07342069 Jani Nikula 2022-09-16 1099 return single_open(file, i915_hpd_short_storm_ctl_show,
1bed8b07342069 Jani Nikula 2022-09-16 1100 inode->i_private);
1bed8b07342069 Jani Nikula 2022-09-16 1101 }
1bed8b07342069 Jani Nikula 2022-09-16 1102
fb267b131a04cf Jens Axboe 2024-04-09 1103 static ssize_t i915_hpd_short_storm_ctl_write(struct kiocb *iocb,
fb267b131a04cf Jens Axboe 2024-04-09 1104 struct iov_iter *from)
1bed8b07342069 Jani Nikula 2022-09-16 1105 {
fb267b131a04cf Jens Axboe 2024-04-09 1106 struct seq_file *m = iocb->ki_filp->private_data;
1bed8b07342069 Jani Nikula 2022-09-16 1107 struct drm_i915_private *dev_priv = m->private;
1bed8b07342069 Jani Nikula 2022-09-16 1108 struct intel_hotplug *hotplug = &dev_priv->display.hotplug;
fb267b131a04cf Jens Axboe 2024-04-09 1109 size_t len = iov_iter_count(from);
1bed8b07342069 Jani Nikula 2022-09-16 1110 char *newline;
1bed8b07342069 Jani Nikula 2022-09-16 1111 char tmp[16];
1bed8b07342069 Jani Nikula 2022-09-16 1112 int i;
1bed8b07342069 Jani Nikula 2022-09-16 1113 bool new_state;
1bed8b07342069 Jani Nikula 2022-09-16 1114
1bed8b07342069 Jani Nikula 2022-09-16 1115 if (len >= sizeof(tmp))
1bed8b07342069 Jani Nikula 2022-09-16 1116 return -EINVAL;
1bed8b07342069 Jani Nikula 2022-09-16 1117
fb267b131a04cf Jens Axboe 2024-04-09 1118 if (!copy_from_iter_full(tmp, len, from))
1bed8b07342069 Jani Nikula 2022-09-16 1119 return -EFAULT;
1bed8b07342069 Jani Nikula 2022-09-16 1120
1bed8b07342069 Jani Nikula 2022-09-16 @1121 tmp[len] = '\0';
1bed8b07342069 Jani Nikula 2022-09-16 1122
1bed8b07342069 Jani Nikula 2022-09-16 1123 /* Strip newline, if any */
1bed8b07342069 Jani Nikula 2022-09-16 1124 newline = strchr(tmp, '\n');
1bed8b07342069 Jani Nikula 2022-09-16 1125 if (newline)
1bed8b07342069 Jani Nikula 2022-09-16 1126 *newline = '\0';
1bed8b07342069 Jani Nikula 2022-09-16 1127
1bed8b07342069 Jani Nikula 2022-09-16 1128 /* Reset to the "default" state for this system */
1bed8b07342069 Jani Nikula 2022-09-16 1129 if (strcmp(tmp, "reset") == 0)
1bed8b07342069 Jani Nikula 2022-09-16 1130 new_state = !HAS_DP_MST(dev_priv);
1bed8b07342069 Jani Nikula 2022-09-16 1131 else if (kstrtobool(tmp, &new_state) != 0)
1bed8b07342069 Jani Nikula 2022-09-16 1132 return -EINVAL;
1bed8b07342069 Jani Nikula 2022-09-16 1133
1bed8b07342069 Jani Nikula 2022-09-16 1134 drm_dbg_kms(&dev_priv->drm, "%sabling HPD short storm detection\n",
1bed8b07342069 Jani Nikula 2022-09-16 1135 new_state ? "En" : "Dis");
1bed8b07342069 Jani Nikula 2022-09-16 1136
1bed8b07342069 Jani Nikula 2022-09-16 1137 spin_lock_irq(&dev_priv->irq_lock);
1bed8b07342069 Jani Nikula 2022-09-16 1138 hotplug->hpd_short_storm_enabled = new_state;
1bed8b07342069 Jani Nikula 2022-09-16 1139 /* Reset the HPD storm stats so we don't accidentally trigger a storm */
1bed8b07342069 Jani Nikula 2022-09-16 1140 for_each_hpd_pin(i)
1bed8b07342069 Jani Nikula 2022-09-16 1141 hotplug->stats[i].count = 0;
1bed8b07342069 Jani Nikula 2022-09-16 1142 spin_unlock_irq(&dev_priv->irq_lock);
1bed8b07342069 Jani Nikula 2022-09-16 1143
1bed8b07342069 Jani Nikula 2022-09-16 1144 /* Re-enable hpd immediately if we were in an irq storm */
1bed8b07342069 Jani Nikula 2022-09-16 1145 flush_delayed_work(&dev_priv->display.hotplug.reenable_work);
1bed8b07342069 Jani Nikula 2022-09-16 1146
1bed8b07342069 Jani Nikula 2022-09-16 1147 return len;
1bed8b07342069 Jani Nikula 2022-09-16 1148 }
1bed8b07342069 Jani Nikula 2022-09-16 1149
:::::: The code at line 1040 was first introduced by commit
:::::: 1bed8b07342069ebfbab6794e5ce3084c3eb9bc8 drm/i915/hotplug: move hotplug storm debugfs to intel_hotplug.c
:::::: TO: Jani Nikula <jani.nikula@intel.com>
:::::: CC: Jani Nikula <jani.nikula@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2024-09-22 15:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202409222356.Id5VC2Ol-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.