[PATCH] perf bench: Fix null check

Weiguo Li posted 1 patch 4 years, 3 months ago
tools/perf/bench/epoll-ctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] perf bench: Fix null check
Posted by Weiguo Li 4 years, 3 months ago
We did a null check after "epollfdp = calloc(...)", but we checked
"epollfd" instead of "epollfdp".

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 tools/perf/bench/epoll-ctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/bench/epoll-ctl.c b/tools/perf/bench/epoll-ctl.c
index 740ae764537e..134612bde0cb 100644
--- a/tools/perf/bench/epoll-ctl.c
+++ b/tools/perf/bench/epoll-ctl.c
@@ -106,7 +106,7 @@ static void nest_epollfd(void)
 	printinfo("Nesting level(s): %d\n", nested);
 
 	epollfdp = calloc(nested, sizeof(int));
-	if (!epollfd)
+	if (!epollfdp)
 		err(EXIT_FAILURE, "calloc");
 
 	for (i = 0; i < nested; i++) {
-- 
2.25.1
Re: [PATCH] perf bench: Fix null check
Posted by Davidlohr Bueso 4 years, 3 months ago
On Fri, 11 Mar 2022, Weiguo Li wrote:

>We did a null check after "epollfdp = calloc(...)", but we checked
>"epollfd" instead of "epollfdp".
>
>Signed-off-by: Weiguo Li <liwg06@foxmail.com>

Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Re: [PATCH] perf bench: Fix null check
Posted by Arnaldo Carvalho de Melo 4 years, 3 months ago
Em Fri, Mar 11, 2022 at 11:08:56AM -0800, Davidlohr Bueso escreveu:
> On Fri, 11 Mar 2022, Weiguo Li wrote:
> 
> > We did a null check after "epollfdp = calloc(...)", but we checked
> > "epollfd" instead of "epollfdp".
> > 
> > Signed-off-by: Weiguo Li <liwg06@foxmail.com>
> 
> Acked-by: Davidlohr Bueso <dave@stgolabs.net>


Thanks, applied.

- Arnaldo