* [PATCH][next] staging: wfx: fix swapped arguments in memset call
@ 2019-10-09 9:46 Colin King
2019-10-09 14:06 ` Jerome Pouiller
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-10-09 9:46 UTC (permalink / raw)
To: Jérôme Pouiller, Greg Kroah-Hartman, devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
The memset appears to have the 2nd and 3rd arguments in the wrong
order, fix this by swapping these around into the correct order.
Addresses-Coverity: ("Memset fill truncated")
Fixes: 4f8b7fabb15d ("staging: wfx: allow to send commands to chip")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/wfx/debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c
index 8de16ad7c710..761ad9b4f27e 100644
--- a/drivers/staging/wfx/debug.c
+++ b/drivers/staging/wfx/debug.c
@@ -226,7 +226,7 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user
// wfx_cmd_send() chekc that reply buffer is wide enough, but do not
// return precise length read. User have to know how many bytes should
// be read. Filling reply buffer with a memory pattern may help user.
- memset(context->reply, sizeof(context->reply), 0xFF);
+ memset(context->reply, 0xFF, sizeof(context->reply));
request = memdup_user(user_buf, count);
if (IS_ERR(request))
return PTR_ERR(request);
--
2.20.1
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] staging: wfx: fix swapped arguments in memset call
2019-10-09 9:46 [PATCH][next] staging: wfx: fix swapped arguments in memset call Colin King
@ 2019-10-09 14:06 ` Jerome Pouiller
0 siblings, 0 replies; 2+ messages in thread
From: Jerome Pouiller @ 2019-10-09 14:06 UTC (permalink / raw)
To: Colin King; +Cc: devel, Greg Kroah-Hartman, kernel-janitors, linux-kernel
On Wednesday 9 October 2019 11:46:08 CEST Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The memset appears to have the 2nd and 3rd arguments in the wrong
> order, fix this by swapping these around into the correct order.
>
> Addresses-Coverity: ("Memset fill truncated")
> Fixes: 4f8b7fabb15d ("staging: wfx: allow to send commands to chip")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/staging/wfx/debug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c
> index 8de16ad7c710..761ad9b4f27e 100644
> --- a/drivers/staging/wfx/debug.c
> +++ b/drivers/staging/wfx/debug.c
> @@ -226,7 +226,7 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user
> // wfx_cmd_send() chekc that reply buffer is wide enough, but do not
> // return precise length read. User have to know how many bytes should
> // be read. Filling reply buffer with a memory pattern may help user.
> - memset(context->reply, sizeof(context->reply), 0xFF);
> + memset(context->reply, 0xFF, sizeof(context->reply));
> request = memdup_user(user_buf, count);
> if (IS_ERR(request))
> return PTR_ERR(request);
Ouch! I realize that "-Wmemset-transposed-args" and/or "-Wmemset-elt-size"
don't catch this case.
Thank you for your attentive reading.
Reviewed-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
--
Jérôme Pouiller
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-09 14:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 9:46 [PATCH][next] staging: wfx: fix swapped arguments in memset call Colin King
2019-10-09 14:06 ` Jerome Pouiller
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).