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: <63d45a76-6ead-4d62-bbca-5b1e3d542f1c@intel.com>
Date: Wed, 28 Aug 2024 15:31:08 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Edward Cree <ecree.xilinx@...il.com>, Shen Lichuan <shenlichuan@...o.com>,
	<habetsm.xilinx@...il.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>
CC: <netdev@...r.kernel.org>, <linux-net-drivers@....com>,
	<linux-kernel@...r.kernel.org>, <opensource.kernel@...o.com>
Subject: Re: [PATCH v1] sfc: Convert to use ERR_CAST()



On 8/28/2024 6:23 AM, Edward Cree wrote:
> On 28/08/2024 11:00, Shen Lichuan wrote:
>> As opposed to open-code, using the ERR_CAST macro clearly indicates that 
>> this is a pointer to an error value and a type conversion was performed.
>>
>> Signed-off-by: Shen Lichuan <shenlichuan@...o.com>
>> ---
>>  drivers/net/ethernet/sfc/tc_counters.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/sfc/tc_counters.c b/drivers/net/ethernet/sfc/tc_counters.c
>> index c44088424323..76d32641202b 100644
>> --- a/drivers/net/ethernet/sfc/tc_counters.c
>> +++ b/drivers/net/ethernet/sfc/tc_counters.c
>> @@ -249,7 +249,7 @@ struct efx_tc_counter_index *efx_tc_flower_get_counter_index(
>>  					       &ctr->linkage,
>>  					       efx_tc_counter_id_ht_params);
>>  			kfree(ctr);

I was confused because I was wondering why you would kfree the error
value.. until I realized that this function has both "ctr" and "ctn".

>> -			return (void *)cnt; /* it's an ERR_PTR */
>> +			return ERR_CAST(cnt); /* it's an ERR_PTR */
> 
> May as well remove the now superfluous comment.
> Other than that this lgtm.
> 

Somewhat unrelated but you could cleanup some of the confusion by using
__free(kfree) annotation from <linux/cleanup.h> to avoid needing to
manually free ctr in error paths, and just use return_ptr() return the
value at the end.

Anyways, with the removal of the comment suggested by Edward,

Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ