Re: [PATCH v1] PM: runtime: Add support to disable wakeup sources
From: kernel test robot
Date: Sun Aug 21 2022 - 16:07:11 EST
Hi Vimal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.0-rc1 next-20220819]
[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/Vimal-Kumar/PM-runtime-Add-support-to-disable-wakeup-sources/20220821-214614
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: i386-randconfig-s003 (https://download.01.org/0day-ci/archive/20220822/202208220446.3Qzss7sC-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/dee2f4d4c4b79cbfc7b2c792294b5137872d7c0c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vimal-Kumar/PM-runtime-Add-support-to-disable-wakeup-sources/20220821-214614
git checkout dee2f4d4c4b79cbfc7b2c792294b5137872d7c0c
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/base/power/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> drivers/base/power/wakeup_stats.c:225:37: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char const *buf @@
drivers/base/power/wakeup_stats.c:225:37: sparse: expected void const [noderef] __user *from
drivers/base/power/wakeup_stats.c:225:37: sparse: got char const *buf
vim +225 drivers/base/power/wakeup_stats.c
211
212 static ssize_t disable_ws_store(struct class *class,
213 struct class_attribute *attr,
214 const char *buf, size_t len)
215 {
216 struct device *dev;
217 struct wakeup_source *ws;
218 char *ws_name;
219 int status;
220
221 ws_name = kzalloc(sizeof(*(buf)), GFP_KERNEL);
222 if (!ws_name)
223 return -ENOMEM;
224
> 225 if (copy_from_user(ws_name, buf, sizeof(*(buf))))
226 return -EFAULT;
227
228 dev = class_find_device_by_name(wakeup_class, ws_name);
229 if (!dev)
230 pr_err("%s : %s dev not found\n", __func__, ws_name);
231
232 ws = dev_get_drvdata(dev);
233 if (ws->dev->parent != NULL) {
234
235 status = device_wakeup_disable(ws->dev->parent);
236 if (status < 0) {
237 /* In case of virtual device, return code will be -EINVAL
238 * then unregister the wakeup source associated with it
239 */
240 wakeup_source_unregister(ws);
241 }
242 } else
243 /* If the parent device is NULL, just unregister the wakeup source */
244 wakeup_source_unregister(ws);
245
246 return len;
247 }
248
--
0-DAY CI Kernel Test Service
https://01.org/lkp