[dpdk-dev] [PATCH] eal: avoid side effects in RTE_ALIGN_MUL_NEAR(v, mul) for v and mul

Ranjit Menon ranjit.menon at intel.com
Fri Mar 12 05:41:58 CET 2021


On 3/11/2021 5:34 PM, Tyler Retzlaff wrote:
> On Thu, Mar 11, 2021 at 04:40:58PM -0800, Ranjit Menon wrote:
>> On 3/11/2021 1:08 PM, Tyler Retzlaff wrote:
>>> diff --git a/lib/librte_eal/include/rte_common.h b/lib/librte_eal/include/rte_common.h
>>> index 1b630baf1..640befee2 100644
>>> --- a/lib/librte_eal/include/rte_common.h
>>> +++ b/lib/librte_eal/include/rte_common.h
>>> @@ -345,9 +345,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
>>>    */
>>>   #define RTE_ALIGN_MUL_NEAR(v, mul)				\
>>>   	({							\
>>> -		typeof(v) ceil = RTE_ALIGN_MUL_CEIL(v, mul);	\
>>> -		typeof(v) floor = RTE_ALIGN_MUL_FLOOR(v, mul);	\
>>> -		(ceil - (v)) > ((v) - floor) ? floor : ceil;	\
>>> +		typeof(v) _v = (v);				\
>>> +		typeof(v) _m = (mul);				\
>> For consistency sake, can this variable be changed to '_mul'?
> sure, i can do that. it will hit another tab stop below though.
> i'll submit a v2 with the requested change.

Ugh! In that case, let it be. If others insist on the change, we can do it.

ranjit m.

>
>>> +		typeof(v) ceil = RTE_ALIGN_MUL_CEIL(_v, _m);	\
>>> +		typeof(v) floor = RTE_ALIGN_MUL_FLOOR(_v, _m);	\
>>> +		(ceil - (_v)) > ((_v) - floor) ? floor : ceil;	\
>>>   	})
>>>   /**
>>
>> ranjit m.


More information about the dev mailing list