* [PATCH v1 1/1] memory: handle invalid socket ID's when allocating
@ 2025-06-20 13:30 Anatoly Burakov
2025-06-20 13:37 ` Bruce Richardson
0 siblings, 1 reply; 4+ messages in thread
From: Anatoly Burakov @ 2025-06-20 13:30 UTC (permalink / raw)
To: dev
This issue was reported by static analysis. It is a false positive,
because both `rte_socket_count` and `rte_socket_id_by_idx` only report
information about physical sockets, and these specific calls are made
during EAL initialization, so no other sockets (i.e. external) could have
been available, so it is pretty much impossible to get invalid return here.
Still, to avoid future false positives, we can fix it here.
Coverity issue: 470131
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/eal/linux/eal_memory.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c
index 59f35b415e..e433c1afee 100644
--- a/lib/eal/linux/eal_memory.c
+++ b/lib/eal/linux/eal_memory.c
@@ -1785,8 +1785,14 @@ memseg_primary_init_32(void)
unsigned int main_lcore_socket;
struct rte_config *cfg = rte_eal_get_configuration();
bool skip;
+ int ret;
- socket_id = rte_socket_id_by_idx(i);
+ ret = rte_socket_id_by_idx(i);
+ if (ret == -1) {
+ EAL_LOG(ERR, "Cannot get socket ID for socket index %u", i);
+ return -1;
+ }
+ socket_id = (unsigned int)ret;
#ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES
/* we can still sort pages by socket in legacy mode */
--
2.47.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] memory: handle invalid socket ID's when allocating
2025-06-20 13:30 [PATCH v1 1/1] memory: handle invalid socket ID's when allocating Anatoly Burakov
@ 2025-06-20 13:37 ` Bruce Richardson
2025-06-27 10:44 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Bruce Richardson @ 2025-06-20 13:37 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev
On Fri, Jun 20, 2025 at 02:30:23PM +0100, Anatoly Burakov wrote:
> This issue was reported by static analysis. It is a false positive,
> because both `rte_socket_count` and `rte_socket_id_by_idx` only report
> information about physical sockets, and these specific calls are made
> during EAL initialization, so no other sockets (i.e. external) could have
> been available, so it is pretty much impossible to get invalid return here.
>
> Still, to avoid future false positives, we can fix it here.
>
> Coverity issue: 470131
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] memory: handle invalid socket ID's when allocating
2025-06-20 13:37 ` Bruce Richardson
@ 2025-06-27 10:44 ` Thomas Monjalon
2025-06-27 10:46 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2025-06-27 10:44 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Bruce Richardson
20/06/2025 15:37, Bruce Richardson:
> On Fri, Jun 20, 2025 at 02:30:23PM +0100, Anatoly Burakov wrote:
> > This issue was reported by static analysis. It is a false positive,
> > because both `rte_socket_count` and `rte_socket_id_by_idx` only report
> > information about physical sockets, and these specific calls are made
> > during EAL initialization, so no other sockets (i.e. external) could have
> > been available, so it is pretty much impossible to get invalid return here.
> >
> > Still, to avoid future false positives, we can fix it here.
> >
> > Coverity issue: 470131
> >
> > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Applied, thanks?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] memory: handle invalid socket ID's when allocating
2025-06-27 10:44 ` Thomas Monjalon
@ 2025-06-27 10:46 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2025-06-27 10:46 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev, Bruce Richardson
27/06/2025 12:44, Thomas Monjalon:
> 20/06/2025 15:37, Bruce Richardson:
> > On Fri, Jun 20, 2025 at 02:30:23PM +0100, Anatoly Burakov wrote:
> > > This issue was reported by static analysis. It is a false positive,
> > > because both `rte_socket_count` and `rte_socket_id_by_idx` only report
> > > information about physical sockets, and these specific calls are made
> > > during EAL initialization, so no other sockets (i.e. external) could have
> > > been available, so it is pretty much impossible to get invalid return here.
> > >
> > > Still, to avoid future false positives, we can fix it here.
> > >
> > > Coverity issue: 470131
> > >
> > > Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> > Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
> Applied, thanks?
Sorry for this typo, it was not supposed to be a question mark.
Yes you absolutely deserve some thanks for your continuous maintenance
of the DPDK memory subsystem. Thank you Anatoly :)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-27 10:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-20 13:30 [PATCH v1 1/1] memory: handle invalid socket ID's when allocating Anatoly Burakov
2025-06-20 13:37 ` Bruce Richardson
2025-06-27 10:44 ` Thomas Monjalon
2025-06-27 10:46 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).