So in my patch it was changed to only one memory access.

________________________________
发件人: Stephen Hemminger <step...@networkplumber.org>
发送时间: 2020年3月5日 1:37
收件人: tgw_team(腾讯网关团队)
抄送: Tencent TGW team; Thomas Monjalon; Ferruh Yigit; Andrew Rybchenko; 
dev@dpdk.org
主题: Re: [dpdk-dev] [PATCH] rte_ethdev: fix unsafe memory access by calling RX 
callback.(Internet mail)

On Wed, 4 Mar 2020 16:38:13 +0000
tgw_team(腾讯网关团队) <tgw_t...@tencent.com> wrote:

> Sorry, I`ll use a real name in patch v2.
>
> I don't think this is a TOCTOU question.
> The original code works fine when compiled with the -O3 option.
> At this point the compiler will optimize to one memory access.
> But when compiled with -O0, there will be two memory accesses, which is wrong.
> This change was modified with reference to the rte_eth_tx_burst function.

There is nothing C standard that says compiler has to do it either way.
The optimizer may decide to do two memory accesses or one.
Depending on that in anyway is bad practice.

Reply via email to