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: <aedd91ee-e84b-4d83-9feb-f87954dffb17@intel.com>
Date: Mon, 23 Jun 2025 16:43:24 -0700
From: Jacob Keller <jacob.e.keller@...el.com>
To: Jakub Kicinski <kuba@...nel.org>, Tony Nguyen <anthony.l.nguyen@...el.com>
CC: <davem@...emloft.net>, <pabeni@...hat.com>, <edumazet@...gle.com>,
	<andrew+netdev@...n.ch>, <netdev@...r.kernel.org>, Karol Kolacinski
	<karol.kolacinski@...el.com>, <przemyslaw.kitszel@...el.com>,
	<richardcochran@...il.com>, Michal Kubiak <michal.kubiak@...el.com>, "Milena
 Olech" <milena.olech@...el.com>, Rinitha S <sx.rinitha@...el.com>
Subject: Re: [PATCH net-next 07/15] ice: add ICE_READ/WRITE_CGU_REG_OR_DIE
 helpers



On 6/21/2025 8:23 AM, Jakub Kicinski wrote:
> On Wed, 18 Jun 2025 10:42:19 -0700 Tony Nguyen wrote:
>> +#define ICE_READ_CGU_REG_OR_DIE(hw, addr, val)                     \
>> +	do {                                                       \
>> +		int __err = ice_read_cgu_reg((hw), (addr), (val)); \
>> +								   \
>> +		if (__err)                                         \
>> +			return __err;                              \
>> +	} while (0)
>>  int ice_write_cgu_reg(struct ice_hw *hw, u32 addr, u32 val);
>> +#define ICE_WRITE_CGU_REG_OR_DIE(hw, addr, val)                     \
>> +	do {                                                        \
>> +		int __err = ice_write_cgu_reg((hw), (addr), (val)); \
>> +								    \
>> +		if (__err)                                          \
>> +			return __err;                               \
>> +	} while (0)
> 
> Quoting documentation:
> 
>   12) Macros, Enums and RTL
>   -------------------------
>   
> [...]
> 
>   Things to avoid when using macros:
>   
>   1) macros that affect control flow:
>   
>   .. code-block:: c
>   
>   	#define FOO(x)					\
>   		do {					\
>   			if (blah(x) < 0)		\
>   				return -EBUGGERED;	\
>   		} while (0)
>   
>   is a **very** bad idea.  It looks like a function call but exits the ``calling``
>   function; don't break the internal parsers of those who will read the code.
>   
> See: https://www.kernel.org/doc/html/next/process/coding-style.html#macros-enums-and-rtl

I will rework the remaining patches to avoid this.

Thanks,
Jake

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ