lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <192edb77-b811-7ec2-9722-a767fd29cdf0@huawei.com>
Date:   Thu, 30 Jul 2020 14:19:02 +0800
From:   "wanghai (M)" <wanghai38@...wei.com>
To:     Joe Perches <joe@...ches.com>, <dchickles@...vell.com>,
        <sburla@...vell.com>, <fmanlunas@...vell.com>,
        <davem@...emloft.net>, <kuba@...nel.org>
CC:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] liquidio: Remove unneeded cast from memory
 allocation


在 2020/7/28 23:54, Joe Perches 写道:
> On Tue, 2020-07-28 at 21:38 +0800, wanghai (M) wrote:
>> Thanks for your explanation. I got it.
>>
>> Can it be modified like this?
> []
>> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
>> @@ -1152,11 +1152,8 @@ octeon_register_dispatch_fn(struct octeon_device
>> *oct,
>>
>>                   dev_dbg(&oct->pci_dev->dev,
>>                           "Adding opcode to dispatch list linked list\n");
>> -               dispatch = (struct octeon_dispatch *)
>> -                          vmalloc(sizeof(struct octeon_dispatch));
>> +               dispatch = kmalloc(sizeof(struct octeon_dispatch),
>> GFP_KERNEL);
>>                   if (!dispatch) {
>> -                       dev_err(&oct->pci_dev->dev,
>> -                               "No memory to add dispatch function\n");
>>                           return 1;
>>                   }
>>                   dispatch->opcode = combined_opcode;
> Yes, but the free also needs to be changed.
>
> I think it's:
> ---
>   drivers/net/ethernet/cavium/liquidio/octeon_device.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/cavium/liquidio/octeon_device.c b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> index 934115d18488..4ee4cb946e1d 100644
> --- a/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> +++ b/drivers/net/ethernet/cavium/liquidio/octeon_device.c
> @@ -1056,7 +1056,7 @@ void octeon_delete_dispatch_list(struct octeon_device *oct)
>   
>   	list_for_each_safe(temp, tmp2, &freelist) {
>   		list_del(temp);
> -		vfree(temp);
> +		kfree(temp);
>   	}
>   }
>   
> @@ -1152,13 +1152,10 @@ octeon_register_dispatch_fn(struct octeon_device *oct,
>   
>   		dev_dbg(&oct->pci_dev->dev,
>   			"Adding opcode to dispatch list linked list\n");
> -		dispatch = (struct octeon_dispatch *)
> -			   vmalloc(sizeof(struct octeon_dispatch));
> -		if (!dispatch) {
> -			dev_err(&oct->pci_dev->dev,
> -				"No memory to add dispatch function\n");
> +		dispatch = kmalloc(sizeof(struct octeon_dispatch), GFP_KERNEL);
> +		if (!dispatch)
>   			return 1;
> -		}
> +
>   		dispatch->opcode = combined_opcode;
>   		dispatch->dispatch_fn = fn;
>   		dispatch->arg = fn_arg;
>
>
>
> .
Thanks for your suggestion. I just sent another patch for this.

"[PATCH net-next] liquidio: Replace vmalloc with kmalloc in 
octeon_register_dispatch_fn()"

>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ