staging: rts5208: Assign array_size() to a variable
PATCH 1/1 staging: rts5208: Assign array_size() to a variable
Assign array_size() to variable _size_ and use it in multiple places.
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 <[email protected]>
--- drivers/staging/rts5208/rtsx_chip.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rts5208/rtsx_chip.c +6 -6
@@ -1440,6 +1440,7 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,u16 aligned_addr = addr - offset;int dw_len, i, j;int retval; +size_t size;if (!buf)return STATUS_NOMEM ;
@@ -1451,11 +1452,12 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf,dev_dbg (rtsx_dev (chip),"dw_len = %d\n" , dw_len); - data =vzalloc (array_size (dw_len,4 )); + size =array_size (dw_len,4 ); + data =vzalloc (size);if (!data)return STATUS_NOMEM ; - mask =vzalloc (array_size (dw_len,4 )); + mask =vzalloc (size);if (!mask) {vfree (data);return STATUS_NOMEM ;
@@ -1471,10 +1473,8 @@ int rtsx_write_cfg_seq(struct rtsx_chip *chip, u8 func, u16 addr, u8 *buf, } } -print_hex_dump_bytes (KBUILD_MODNAME ": " ,DUMP_PREFIX_NONE , mask, - dw_len *4 ); -print_hex_dump_bytes (KBUILD_MODNAME ": " ,DUMP_PREFIX_NONE , data, - dw_len *4 ); +print_hex_dump_bytes (KBUILD_MODNAME ": " ,DUMP_PREFIX_NONE , mask, size); +print_hex_dump_bytes (KBUILD_MODNAME ": " ,DUMP_PREFIX_NONE , data, size);for (i =0 ; i < dw_len; i++) { retval = rtsx_write_cfg_dw(chip, func, aligned_addr + i * 4,
Signature · 1 line
2.27.0