2022-03-11 20:43:49

by Weiguo Li

[permalink] [raw]
Subject: [PATCH] perf bench: Fix null check

We did a null check after "epollfdp = calloc(...)", but we checked
"epollfd" instead of "epollfdp".

Signed-off-by: Weiguo Li <[email protected]>
---
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



2022-03-11 22:26:39

by Davidlohr Bueso

[permalink] [raw]
Subject: Re: [PATCH] perf bench: Fix null check

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 <[email protected]>

Acked-by: Davidlohr Bueso <[email protected]>

2022-03-12 15:16:12

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH] perf bench: Fix null check

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 <[email protected]>
>
> Acked-by: Davidlohr Bueso <[email protected]>


Thanks, applied.

- Arnaldo