All of lore.kernel.org
 help / color / mirror / Atom feed
* [mchinth:sep_socwatch_linux_5_5 28/29] drivers/platform/x86/socwatch/sw_driver.c:1058 sw_get_cta_aggregators_i() warn: maybe return -EFAULT instead of the bytes remaining?
@ 2020-01-03  7:25 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-01-03  7:25 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]

tree:   https://github.com/mchinth/linux sep_socwatch_linux_5_5
head:   2700ee532223884d15fda737936627a209f07e6d
commit: f5143b5fa69b72d17dae5c27ee25edcbd389d05f [28/29] platform/x86: Update SoCWatch driver for 5.4 pull

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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?

# https://github.com/mchinth/linux/commit/f5143b5fa69b72d17dae5c27ee25edcbd389d05f
git remote add mchinth https://github.com/mchinth/linux
git remote update mchinth
git checkout f5143b5fa69b72d17dae5c27ee25edcbd389d05f
vim +1058 drivers/platform/x86/socwatch/sw_driver.c

  1034          dst = (struct sw_driver_topology_change *)&local_msg
  1035                        ->topology_entries[0];
  1036          SW_LIST_FOR_EACH_ENTRY(tnode, head, list)
  1037          {
  1038                  struct sw_driver_topology_change *change = &tnode->change;
  1039  
  1040                  memcpy(&dst[dst_idx++], change, sizeof(*change));
  1041          }
  1042          retVal = copy_to_user(remote_msg, local_msg, buffer_len);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  1043          if (retVal)
  1044                  pw_pr_error(
  1045                          "ERROR: couldn't copy topology changes to user space!\n");
  1046  
  1047          vfree(buffer);
  1048          return retVal;
  1049  }
  1050  
  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));
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This gets passed back to the user as an ioctl return.

  1057  
  1058          return retval;
  1059  }


---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [mchinth:sep_socwatch_linux_5_5 28/29] drivers/platform/x86/socwatch/sw_driver.c:1058 sw_get_cta_aggregators_i() warn: maybe return -EFAULT instead of the bytes remaining?
@ 2020-01-03  7:25 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-01-03  7:25 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2732 bytes --]

tree:   https://github.com/mchinth/linux sep_socwatch_linux_5_5
head:   2700ee532223884d15fda737936627a209f07e6d
commit: f5143b5fa69b72d17dae5c27ee25edcbd389d05f [28/29] platform/x86: Update SoCWatch driver for 5.4 pull

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

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?

# https://github.com/mchinth/linux/commit/f5143b5fa69b72d17dae5c27ee25edcbd389d05f
git remote add mchinth https://github.com/mchinth/linux
git remote update mchinth
git checkout f5143b5fa69b72d17dae5c27ee25edcbd389d05f
vim +1058 drivers/platform/x86/socwatch/sw_driver.c

  1034          dst = (struct sw_driver_topology_change *)&local_msg
  1035                        ->topology_entries[0];
  1036          SW_LIST_FOR_EACH_ENTRY(tnode, head, list)
  1037          {
  1038                  struct sw_driver_topology_change *change = &tnode->change;
  1039  
  1040                  memcpy(&dst[dst_idx++], change, sizeof(*change));
  1041          }
  1042          retVal = copy_to_user(remote_msg, local_msg, buffer_len);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  1043          if (retVal)
  1044                  pw_pr_error(
  1045                          "ERROR: couldn't copy topology changes to user space!\n");
  1046  
  1047          vfree(buffer);
  1048          return retVal;
  1049  }
  1050  
  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));
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This gets passed back to the user as an ioctl return.

  1057  
  1058          return retval;
  1059  }


---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-03  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-03  7:25 [mchinth:sep_socwatch_linux_5_5 28/29] drivers/platform/x86/socwatch/sw_driver.c:1058 sw_get_cta_aggregators_i() warn: maybe return -EFAULT instead of the bytes remaining? Dan Carpenter
2020-01-03  7:25 ` Dan Carpenter

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.