mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-29 03:31:04 -04:00
staging: rts5208: Use array_size() helper in vmalloc() 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> Link: https://lore.kernel.org/r/20200616175543.GA28687@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
21b1f2b3fb
commit
9e43eed45a
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user