lkml.org 
[lkml]   [2020]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH][next] scsi: fnic: Replace vmalloc() + memset() with vzalloc() and use array_size()
From
Date
On Tue, 2020-06-16 at 00:19 +0000, Satish Kharat (satishkh) wrote:
> Reviewed-by: Satish Kharat <satishkh@cisco.com>
> 
>
> On 6/15/20, 3:49 PM, "Gustavo A. R. Silva" <gustavoars@kernel.org> 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 <gustavoars@kernel.org>
> ---
> 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);


\
 
 \ /
  Last update: 2020-06-16 06:42    [W:0.105 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site