On Tue, 2020-06-16 at 00:19 +0000, Satish Kharat (satishkh) wrote:
> Reviewed-by: Satish Kharat <[email protected]>
> 
> 
> On 6/15/20, 3:49 PM, "Gustavo A. R. Silva" <[email protected]> wrote:
> 
>     Use vzalloc() instead of the vmalloc() and memset. Also, use array_size()
>     instead of the open-coded version.
>     
>     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/scsi/fnic/fnic_trace.c | 16 ++++------------
>      1 file changed, 4 insertions(+), 12 deletions(-)
>     
>     diff --git a/drivers/scsi/fnic/fnic_trace.c 
> b/drivers/scsi/fnic/fnic_trace.c
[]
>     @@ -488,7 +488,7 @@ int fnic_trace_buf_init(void)
>       }
>      
>       fnic_trace_entries.page_offset =
>     -         vmalloc(array_size(fnic_max_trace_entries,
>     +         vzalloc(array_size(fnic_max_trace_entries,
>                                  sizeof(unsigned long)));

Perhaps better as
                kvcalloc(fnic_max_trace_entries, sizeof(unsigned long),
                         GFP_KERNEL);


Reply via email to