Skip to contentSkip to conversation

drivers/platform/x86/socwatch/sw_driver.c:1058 sw_get_cta_aggregators_i() warn: maybe return -EFAULT instead of the bytes

PATCH New Dan Carpenter 1 participant 1 message Aug 21, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 178/9302 drivers/platform/x86/socwatch/sw_driver.c:1058 sw_get_cta_aggregators_i() warn: maybe return -EFAULT instead of the bytes

tree:   https://github.com/intel/linux-intel-lts.git 5.4/yocto
head:   eeb611e5394c56d45c5cc8f7dc484c9f19e93143
commit: a8d1e48baaa24069690e7178f3d5ebfabc3d52ba [178/9302] platform/x86: Update SoCWatch driver for 5.4 pull
config: x86_64-randconfig-m001-20200818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate

New smatch warnings:
drivers/platform/x86/socwatch/sw_driver.c:1058 sw_get_cta_aggregators_i() warn: maybe return -EFAULT instead of the bytes remaining?

Old smatch warnings:
drivers/platform/x86/socwatch/sw_driver.c:698 sw_set_driver_infos_i() warn: variable dereferenced before check 'local_msg' (see line 695) drivers/platform/x86/socwatch/sw_driver.c:998 sw_get_available_name_id_mappings_i() warn: maybe return -EFAULT instead of the bytes remaining? drivers/platform/x86/socwatch/sw_driver.c:1048 sw_get_topology_changes_i() warn: maybe return -EFAULT instead of the bytes remaining? drivers/platform/x86/socwatch/sw_driver.c:1100 sw_set_continuous_i() warn: inconsistent indenting

# https://github.com/intel/linux-intel-lts/commit/a8d1e48baaa24069690e7178f3d5ebfabc3d52ba
git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-linux-intel-lts 5.4/yocto
git checkout a8d1e48baaa24069690e7178f3d5ebfabc3d52ba
vim +1058 drivers/platform/x86/socwatch/sw_driver.c

  1051  static long
  1052  sw_get_cta_aggregators_i(struct _sw_aggregator_msg __user *remote_msg,
  1053                            size_t local_len)
  1054  {
  1055          const struct _sw_aggregator_msg *_msg = sw_get_cta_aggregators();
  1056          long retval = copy_to_user(remote_msg, _msg, sizeof(*_msg));
  1057  
  1058          return retval;

It should return zero on success and -EFAULT if the copy fails.

1059 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org