* [dpdk-dev] [PATCH 1/1] mem: check allocation in dynamic hugepage init
@ 2021-12-14 13:30 Yunjian Wang
2022-02-05 17:29 ` David Marchand
0 siblings, 1 reply; 3+ messages in thread
From: Yunjian Wang @ 2021-12-14 13:30 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, dingxiaoxiong, xudingke, Yunjian Wang, stable
The function malloc() could return NULL, the return value
need to be checked.
Fixes: 694161b7e065 ("mem: extract common dynamic memory allocation")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
lib/eal/common/eal_common_dynmem.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/eal/common/eal_common_dynmem.c b/lib/eal/common/eal_common_dynmem.c
index 7c5437ddfa..c1e1889f5c 100644
--- a/lib/eal/common/eal_common_dynmem.c
+++ b/lib/eal/common/eal_common_dynmem.c
@@ -304,6 +304,10 @@ eal_dynmem_hugepage_init(void)
needed = num_pages - num_pages_alloc;
pages = malloc(sizeof(*pages) * needed);
+ if (pages == NULL) {
+ RTE_LOG(ERR, EAL, "Failed to malloc pages\n");
+ return -1;
+ }
/* do not request exact number of pages */
cur_pages = eal_memalloc_alloc_seg_bulk(pages,
--
2.27.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] mem: check allocation in dynamic hugepage init
2021-12-14 13:30 [dpdk-dev] [PATCH 1/1] mem: check allocation in dynamic hugepage init Yunjian Wang
@ 2022-02-05 17:29 ` David Marchand
2022-02-11 7:55 ` David Marchand
0 siblings, 1 reply; 3+ messages in thread
From: David Marchand @ 2022-02-05 17:29 UTC (permalink / raw)
To: Yunjian Wang
Cc: dev, Burakov, Anatoly, dingxiaoxiong, xudingke, dpdk stable,
Dmitry Kozlyuk
On Tue, Dec 14, 2021 at 2:30 PM Yunjian Wang <wangyunjian@huawei.com> wrote:
>
> The function malloc() could return NULL, the return value
> need to be checked.
>
> Fixes: 694161b7e065 ("mem: extract common dynamic memory allocation")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] mem: check allocation in dynamic hugepage init
2022-02-05 17:29 ` David Marchand
@ 2022-02-11 7:55 ` David Marchand
0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2022-02-11 7:55 UTC (permalink / raw)
To: Yunjian Wang
Cc: dev, Burakov, Anatoly, dingxiaoxiong, xudingke, dpdk stable,
Dmitry Kozlyuk
On Sat, Feb 5, 2022 at 6:29 PM David Marchand <david.marchand@redhat.com> wrote:
>
> On Tue, Dec 14, 2021 at 2:30 PM Yunjian Wang <wangyunjian@huawei.com> wrote:
> >
> > The function malloc() could return NULL, the return value
> > need to be checked.
> >
> > Fixes: 694161b7e065 ("mem: extract common dynamic memory allocation")
That's actually introduced with:
Fixes: 6f63858e55e6 ("mem: prevent preallocated pages from being freed")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-11 7:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 13:30 [dpdk-dev] [PATCH 1/1] mem: check allocation in dynamic hugepage init Yunjian Wang
2022-02-05 17:29 ` David Marchand
2022-02-11 7:55 ` David Marchand
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).