[dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check

2021-04-25 Thread Min Hu (Connor)
From: HongBo Zheng In function power_guest_channel_read_msg, 'lcore_id' is used before validity check, which may cause buffer 'global_fds' accessed by index 'lcore_id' overflow. This patch moves the validity check of 'lcore_id' before the 'lcore_id' being used for the first time. Fixes: 9dc843e

Re: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check

2021-04-28 Thread Pattan, Reshma
> -Original Message- > From: dev On Behalf Of Min Hu (Connor) > > + if (lcore_id >= RTE_MAX_LCORE) { > + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range > 0...%d\n", > + lcore_id, RTE_MAX_LCORE-1); > + return -1; > +

Re: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check

2021-04-28 Thread Min Hu (Connor)
在 2021/4/28 23:13, Pattan, Reshma 写道: -Original Message- From: dev On Behalf Of Min Hu (Connor) + if (lcore_id >= RTE_MAX_LCORE) { + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n", + lcore_id, RTE_MAX_LCORE-1);

Re: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check

2021-05-11 Thread Thomas Monjalon
Any comment please? 29/04/2021 02:43, Min Hu (Connor): > > 在 2021/4/28 23:13, Pattan, Reshma 写道: > > > > > >> -Original Message- > >> From: dev On Behalf Of Min Hu (Connor) > >> > >> + if (lcore_id >= RTE_MAX_LCORE) { > >> + RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of

Re: [dpdk-dev] [PATCH] lib/librte_power: fix using variables before validity check

2021-05-11 Thread Pattan, Reshma
> -Original Message- > From: Min Hu (Connor) > > Another suggestion if you would like to improve the code, is below, > > You can move "global_fds[lcore_id]" check to immediate after the line > "fds.fd = global_fds[lcore_id]; " > Hi, thanks Pattan. > But I think "global_fds[lcore_id]"