From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, "Jérôme Pouiller" <jerome.pouiller@silabs.com>
Cc: devel@driverdev.osuosl.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
kbuild-all@01.org
Subject: [staging:staging-next 50/93] drivers/staging/wfx/debug.c:112 wfx_send_hif_msg_read() warn: maybe return -EFAULT instead of the bytes remaining?
Date: Tue, 8 Oct 2019 07:35:18 +0300 [thread overview]
Message-ID: <20191008043518.GL21515@kadam> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next
head: e772cd8c9c9cd3d08715800aabaf50b771b395d9
commit: 4f8b7fabb15df3658564a98971fc67029be1815d [50/93] staging: wfx: allow to send commands to chip
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>
smatch warnings:
drivers/staging/wfx/debug.c:112 wfx_send_hif_msg_read() warn: maybe return -EFAULT instead of the bytes remaining?
# https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?id=4f8b7fabb15df3658564a98971fc67029be1815d
git remote add staging https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
git remote update staging
git checkout 4f8b7fabb15df3658564a98971fc67029be1815d
vim +112 drivers/staging/wfx/debug.c
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 95 static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf,
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 96 size_t count, loff_t *ppos)
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 97 {
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 98 struct dbgfs_hif_msg *context = file->private_data;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 99 int ret;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 100
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 101 if (count > sizeof(context->reply))
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 102 return -EINVAL;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 103 ret = wait_for_completion_interruptible(&context->complete);
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 104 if (ret)
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 105 return ret;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 106 if (context->ret < 0)
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 107 return context->ret;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 108 // Be carefull, write() is waiting for a full message while read()
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 109 // only return a payload
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 110 ret = copy_to_user(user_buf, context->reply, count);
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 111 if (ret)
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 @112 return ret;
Yeah. It should be:
if (copy_to_user(user_buf, context->reply, count))
return -EFAULT;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 113
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 114 return count;
4f8b7fabb15df3 Jérôme Pouiller 2019-09-19 115 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
reply other threads:[~2019-10-08 4:35 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=20191008043518.GL21515@kadam \
--to=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jerome.pouiller@silabs.com \
--cc=kbuild-all@01.org \
--cc=kbuild@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).