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: <5ec638ab-e61f-4fe7-b7bc-14c03a0de359@kernel.org>
Date: Tue, 13 May 2025 14:23:23 +0300
From: Roger Quadros <rogerq@...nel.org>
To: Paolo Abeni <pabeni@...hat.com>, Siddharth Vadapalli
 <s-vadapalli@...com>, Andrew Lunn <andrew+netdev@...n.ch>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Russell King <linux@...linux.org.uk>,
 danishanwar@...com
Cc: srk@...com, linux-omap@...r.kernel.org, netdev@...r.kernel.org,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2 7/9] net: ethernet: ti: cpsw_ale: add policer
 save restore for PM sleep



On 08/05/2025 16:49, Paolo Abeni wrote:
> On 5/5/25 6:26 PM, Roger Quadros wrote:
>> diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
>> index ce216606d915..4e29702b86ea 100644
>> --- a/drivers/net/ethernet/ti/cpsw_ale.c
>> +++ b/drivers/net/ethernet/ti/cpsw_ale.c
>> @@ -1823,3 +1823,45 @@ int cpsw_ale_policer_set_entry(struct cpsw_ale *ale, u32 policer_idx,
>>  
>>  	return 0;
>>  }
>> +
>> +void cpsw_ale_policer_save(struct cpsw_ale *ale, u32 *data)
>> +{
>> +	int i, idx;
>> +
>> +	for (idx = 0; idx < ale->params.num_policers; idx++) {
>> +		cpsw_ale_policer_read_idx(ale, idx);
>> +
>> +		for (i = 0; i < CPSW_ALE_POLICER_ENTRY_WORDS; i++)
>> +			data[i] = readl_relaxed(ale->params.ale_regs +
>> +						ALE_POLICER_PORT_OUI + 4 * i);
>> +
>> +		regmap_field_write(ale->fields[ALE_THREAD_CLASS_INDEX], idx);
>> +		data[i++] = readl_relaxed(ale->params.ale_regs +
>> +					ALE_THREAD_VAL);
>> +		data += i * 4;
> 
> I'm confused by the '* 4' part. I think that you just need:
> 		data += i
> 
> to move to the next policer context. I *think* the current code causes
> OoB?!?

Good catch. Since data is u32 pointer we should not need '* 4'

> 
> /P
> 

-- 
cheers,
-roger


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ