From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Kunwu Chan <chentao@kylinos.cn>,
kunwu.chan@hotmail.com, pbonzini@redhat.com, shuah@kernel.org
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: selftests: Add 'malloc' failure check in config_name
Date: Tue, 23 Apr 2024 13:50:01 +0500 [thread overview]
Message-ID: <981053d8-c67a-4958-9016-5f19c7884459@collabora.com> (raw)
In-Reply-To: <20240423073721.2001016-1-chentao@kylinos.cn>
On 4/23/24 12:37 PM, Kunwu Chan wrote:
> There is a 'malloc' call in config_name function, which can
> be unsuccessful. This patch will add the malloc failure checking
> to avoid possible null dereference and give more information
> about test fail reasons.
>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
LGTM
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> tools/testing/selftests/kvm/get-reg-list.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/kvm/get-reg-list.c b/tools/testing/selftests/kvm/get-reg-list.c
> index 91f05f78e824..22398696ffd6 100644
> --- a/tools/testing/selftests/kvm/get-reg-list.c
> +++ b/tools/testing/selftests/kvm/get-reg-list.c
> @@ -66,6 +66,7 @@ static const char *config_name(struct vcpu_reg_list *c)
> len += strlen(s->name) + 1;
>
> c->name = malloc(len);
> + TEST_ASSERT(c->name, "-ENOMEM when allocating config name");
>
> len = 0;
> for_each_sublist(c, s) {
--
BR,
Muhammad Usama Anjum
next prev parent reply other threads:[~2024-04-23 8:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 7:37 Kunwu Chan
2024-04-23 8:50 ` Muhammad Usama Anjum [this message]
2024-04-23 11:10 ` Markus Elfring
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 \
--in-reply-to=981053d8-c67a-4958-9016-5f19c7884459@collabora.com \
--to=usama.anjum@collabora.com \
--cc=chentao@kylinos.cn \
--cc=kunwu.chan@hotmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@kernel.org \
/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
all inboxes | Powered by JetHome®