All of lore.kernel.org
 help / color / mirror / Atom feed
* [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?
@ 2019-10-08  4:35 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-10-08  4:35 UTC (permalink / raw)
  To: kbuild, Jérôme Pouiller; +Cc: devel, Greg Kroah-Hartman, kbuild-all

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

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

* [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?
@ 2019-10-08  4:35 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-10-08  4:35 UTC (permalink / raw)
  To: kbuild

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

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

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

* [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?
@ 2019-10-08  4:35 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-10-08  4:35 UTC (permalink / raw)
  To: kbuild-all

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

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

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

end of thread, other threads:[~2019-10-08  4:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  4:35 [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? Dan Carpenter
2019-10-08  4:35 ` Dan Carpenter
2019-10-08  4:35 ` 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.