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] [thread-next>] [day] [month] [year] [list]
Message-ID: <beedcba6-53c6-4ceb-8d5f-dda93c0f5e41@davidwei.uk>
Date: Sun, 5 May 2024 17:43:39 -0700
From: David Wei <dw@...idwei.uk>
To: Simon Horman <horms@...nel.org>
Cc: netdev@...r.kernel.org, Michael Chan <michael.chan@...adcom.com>,
 Pavan Chebbi <pavan.chebbi@...adcom.com>,
 Andy Gospodarek <andrew.gospodarek@...adcom.com>,
 Adrian Alvarado <adrian.alvarado@...adcom.com>,
 Mina Almasry <almasrymina@...gle.com>, Shailend Chand <shailend@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [RFC PATCH net-next v2 5/9] bnxt: refactor
 bnxt_{alloc,free}_one_tpa_info()

On 2024-05-04 05:30, Simon Horman wrote:
> On Wed, May 01, 2024 at 09:54:06PM -0700, David Wei wrote:
>> Refactor the allocation of each rx ring's tpa_info in
>> bnxt_alloc_tpa_info() out into a standalone function
>> __bnxt_alloc_one_tpa_info().
>>
>> In case of allocation failures during bnxt_alloc_tpa_info(), clean up
>> in-place.
>>
>> Change bnxt_free_tpa_info() to free a single rx ring passed in as a
>> parameter. This makes bnxt_free_rx_rings() more symmetrical.
>>
>> Signed-off-by: David Wei <dw@...idwei.uk>
> 
> Hi David,
> 
> Some minor nits flagged by
> 
> ./scripts/checkpatch.pl --codespell --max-line-length=80 --strict

I didn't run through the usual checks because this is an RFC. I'll fix
it for the next series, thanks.

> 
>> ---
>>  drivers/net/ethernet/broadcom/bnxt/bnxt.c | 95 +++++++++++++++--------
>>  1 file changed, 62 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> 
> ...
> 
>> +static int __bnxt_alloc_one_tpa_info(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
>> +{
> 
> Please consider limiting Networking code to 80 columns wide where
> it can be trivially achieved.
> 
> In this case, perhaps:
> 
> static int __bnxt_alloc_one_tpa_info(struct bnxt *bp,
> 				     struct bnxt_rx_ring_info *rxr)
> 
>> +	struct rx_agg_cmp *agg;
>> +	int i, rc;
>> +
>> +	rxr->rx_tpa = kcalloc(bp->max_tpa, sizeof(struct bnxt_tpa_info),
>> +				GFP_KERNEL);
> 
> The indentation here is not quite right.
> 
> 	rxr->rx_tpa = kcalloc(bp->max_tpa, sizeof(struct bnxt_tpa_info),
> 			      GFP_KERNEL);
> 
>> +	if (!rxr->rx_tpa)
>> +		return -ENOMEM;
>> +
>> +	if (!(bp->flags & BNXT_FLAG_CHIP_P5_PLUS))
>> +		return 0;
>> +
>> +	for (i = 0; i < bp->max_tpa; i++) {
>> +		agg = kcalloc(MAX_SKB_FRAGS, sizeof(*agg), GFP_KERNEL);
>> +		if (!agg) {
>> +			rc = -ENOMEM;
>> +			goto err_free;
>>  		}
>> -		kfree(rxr->rx_tpa);
>> -		rxr->rx_tpa = NULL;
>> +		rxr->rx_tpa[i].agg_arr = agg;
>> +	}
>> +	rxr->rx_tpa_idx_map = kzalloc(sizeof(*rxr->rx_tpa_idx_map),
>> +					GFP_KERNEL);
>> +	if (!rxr->rx_tpa_idx_map) {
>> +		rc = -ENOMEM;
>> +		goto err_free;
>>  	}
>> +
>> +	return 0;
>> +
>> +err_free:
>> +	while(i--) {
> 
> Space before '(' here please.
> 
>> +		kfree(rxr->rx_tpa[i].agg_arr);
>> +		rxr->rx_tpa[i].agg_arr = NULL;
>> +	}
>> +	kfree(rxr->rx_tpa);
>> +	rxr->rx_tpa = NULL;
>> +
>> +	return rc;
>>  }
> 
> ...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ