* [PATCH][next] staging: rts5208: Use array_size() helper in vmalloc()
@ 2020-06-15 23:08 Gustavo A. R. Silva
2020-06-16 10:13 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-06-15 23:08 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: devel, linux-kernel, Gustavo A. R. Silva
and memset()
The vmalloc() function has no 2-factor argument form, so multiplication
factors need to be wrapped in array_size(). Also, while there, use
array_size() in memset().
This issue was found with the help of Coccinelle and, audited and fixed
manually.
Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
drivers/staging/rts5208/ms.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index d53dd138a356..9001570a8c94 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -2306,14 +2306,14 @@ static int ms_build_l2p_tbl(struct rtsx_chip *chip, int seg_no)
if (!segment->l2p_table)
goto BUILD_FAIL;
}
- memset((u8 *)(segment->l2p_table), 0xff, table_size * 2);
+ memset((u8 *)(segment->l2p_table), 0xff, array_size(table_size, 2));
if (!segment->free_table) {
- segment->free_table = vmalloc(MS_FREE_TABLE_CNT * 2);
+ segment->free_table = vmalloc(array_size(MS_FREE_TABLE_CNT, 2));
if (!segment->free_table)
goto BUILD_FAIL;
}
- memset((u8 *)(segment->free_table), 0xff, MS_FREE_TABLE_CNT * 2);
+ memset((u8 *)(segment->free_table), 0xff, array_size(MS_FREE_TABLE_CNT, 2));
start = (u16)seg_no << 9;
end = (u16)(seg_no + 1) << 9;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] staging: rts5208: Use array_size() helper in vmalloc()
2020-06-15 23:08 [PATCH][next] staging: rts5208: Use array_size() helper in vmalloc() Gustavo A. R. Silva
@ 2020-06-16 10:13 ` Dan Carpenter
2020-06-16 14:22 ` Gustavo A. R. Silva
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2020-06-16 10:13 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Greg Kroah-Hartman, devel, linux-kernel, Gustavo A. R. Silva
On Mon, Jun 15, 2020 at 06:08:11PM -0500, Gustavo A. R. Silva wrote:
> and memset()
Please don't start the commit message in the middle of a sentence. It's
a completely different thing from the title. When you're reading the
full email then the title is hidden in the headers and the Date: and
Message-ID: field go in between the title and the message body.
https://lore.kernel.org/lkml/20200615230811.GA18818@embeddedor/
I normally read either the title or the body but seldom read both when
I'm reviewing patches.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] staging: rts5208: Use array_size() helper in vmalloc()
2020-06-16 10:13 ` Dan Carpenter
@ 2020-06-16 14:22 ` Gustavo A. R. Silva
0 siblings, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-06-16 14:22 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, devel, linux-kernel, Gustavo A. R. Silva
On Tue, Jun 16, 2020 at 01:13:12PM +0300, Dan Carpenter wrote:
> On Mon, Jun 15, 2020 at 06:08:11PM -0500, Gustavo A. R. Silva wrote:
> > and memset()
>
> Please don't start the commit message in the middle of a sentence. It's
>
That was, certainly, unintentional. Thanks for letting me know.
--
Gustavo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-06-16 14:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-15 23:08 [PATCH][next] staging: rts5208: Use array_size() helper in vmalloc() Gustavo A. R. Silva
2020-06-16 10:13 ` Dan Carpenter
2020-06-16 14:22 ` Gustavo A. R. Silva
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).