All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [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?
Date: Fri, 03 Jan 2020 10:25:29 +0300	[thread overview]
Message-ID: <20200103072529.GC3889@kadam> (raw)

[-- 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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [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?
Date: Fri, 03 Jan 2020 10:25:29 +0300	[thread overview]
Message-ID: <20200103072529.GC3889@kadam> (raw)

[-- 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

             reply	other threads:[~2020-01-03  7:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-03  7:25 Dan Carpenter [this message]
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

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=20200103072529.GC3889@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /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.