From: Jens Axboe <[email protected]>
To: Ammar Faizi <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>,
Niklas Cassel <[email protected]>,
fio Mailing List <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Subject: Re: [PATCH v1 8/8] client: Add ENOMEM handling on `malloc()`, `calloc()` and `strdup()` calls
Date: Sat, 30 Apr 2022 07:08:06 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 4/28/22 6:47 PM, Ammar Faizi wrote:
> From: Ammar Faizi <[email protected]>
>
> Avoid a NULL pointer dereference bug. There are many places that don't
> handle the ENOMEM case. Add it.
>
> Signed-off-by: Ammar Faizi <[email protected]>
> ---
> client.c | 107 +++++++++++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 89 insertions(+), 18 deletions(-)
>
> @@ -473,6 +478,8 @@ int fio_client_add(struct client_ops *ops, const char *hostname, void **cookie)
> }
>
> client = get_new_client();
> + if (!client)
> + return -ENOMEM;
I don't think we should be using -errno in fio if we can avoid it. Are
there cases where we need to discern one failure from another for alloc
fixes? Looking at this case, we really just want a non-zero return.
--
Jens Axboe
next prev parent reply other threads:[~2022-04-30 13:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 0:46 [PATCH v1 0/8] fio error handling fixes Ammar Faizi
2022-04-29 0:46 ` [PATCH v1 1/8] cgroup: Add ENOMEM handling on a `malloc()` call Ammar Faizi
2022-04-29 18:20 ` Vincent Fu
2022-04-30 3:25 ` Alviro Iskandar Setiawan
2022-04-29 0:46 ` [PATCH v1 2/8] stat: Add ENOMEM handling on `malloc()` / `calloc()` calls Ammar Faizi
2022-04-29 0:47 ` [PATCH v1 3/8] engines/net: Add ENOMEM handling on a `malloc()` call Ammar Faizi
2022-04-29 18:20 ` Vincent Fu
2022-04-29 0:47 ` [PATCH v1 4/8] blktrace: Fix broken error handling in `merge_blktrace_iologs()` Ammar Faizi
2022-04-29 0:47 ` [PATCH v1 5/8] blktrace: Add ENOMEM handling when allocating @ipo Ammar Faizi
2022-04-29 0:47 ` [PATCH v1 6/8] blktrace: Add ENOMEM handling in `trace_add_open_close_event()` and its callers Ammar Faizi
2022-04-29 0:47 ` [PATCH v1 7/8] client: Add ENOMEM handling on `realloc()` calls Ammar Faizi
2022-04-29 0:47 ` [PATCH v1 8/8] client: Add ENOMEM handling on `malloc()`, `calloc()` and `strdup()` calls Ammar Faizi
2022-04-30 13:08 ` Jens Axboe [this message]
2022-04-29 18:21 ` [PATCH v1 0/8] fio error handling fixes Jens Axboe
2022-04-29 20:15 ` Ammar Faizi
2022-04-29 20:37 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox