From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Richard Fitzgerald <rf@opensource.cirrus.com>,
brendan.higgins@linux.dev, davidgow@google.com, rmoar@google.com
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH] kunit: Fix NULL-dereference in kunit_init_suite() if suite->log is NULL
Date: Sat, 30 Dec 2023 12:20:03 +0500 [thread overview]
Message-ID: <36eac3a4-bca9-4648-9154-7a0561476f9f@collabora.com> (raw)
In-Reply-To: <20231218151729.210027-1-rf@opensource.cirrus.com>
On 12/18/23 8:17 PM, Richard Fitzgerald wrote:
> suite->log must be checked for NULL before passing it to
> string_stream_clear(). This was done in kunit_init_test() but was missing
> from kunit_init_suite().
>
> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
> Fixes: 6d696c4695c5 ("kunit: add ability to run tests after boot using debugfs")
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> lib/kunit/test.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index e803d998e855..ea7f0913e55a 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
> @@ -658,7 +658,9 @@ static void kunit_init_suite(struct kunit_suite *suite)
> kunit_debugfs_create_suite(suite);
> suite->status_comment[0] = '\0';
> suite->suite_init_err = 0;
> - string_stream_clear(suite->log);
> +
> + if (suite->log)
> + string_stream_clear(suite->log);
> }
>
> bool kunit_enabled(void)
--
BR,
Muhammad Usama Anjum
prev parent reply other threads:[~2023-12-30 7:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 15:17 Richard Fitzgerald
2023-12-19 21:03 ` Rae Moar
2023-12-22 8:38 ` David Gow
2023-12-30 7:20 ` Muhammad Usama Anjum [this message]
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=36eac3a4-bca9-4648-9154-7a0561476f9f@collabora.com \
--to=usama.anjum@collabora.com \
--cc=brendan.higgins@linux.dev \
--cc=davidgow@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=rf@opensource.cirrus.com \
--cc=rmoar@google.com \
/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®