[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABVgOSmyeEUPEFChW9PJp8pum45H24dnLh24Du_Bujeha0mF4w@mail.gmail.com>
Date: Fri, 1 Dec 2023 11:42:02 +0800
From: David Gow <davidgow@...gle.com>
To: Richard Fitzgerald <rf@...nsource.cirrus.com>
Cc: brendan.higgins@...ux.dev, rmoar@...gle.com,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH v2 RESEND] kunit: debugfs: Handle errors from alloc_string_stream()
On Mon, 30 Oct 2023 at 18:47, Richard Fitzgerald
<rf@...nsource.cirrus.com> wrote:
>
> In kunit_debugfs_create_suite() give up and skip creating the debugfs
> file if any of the alloc_string_stream() calls return an error or NULL.
> Only put a value in the log pointer of kunit_suite and kunit_test if it
> is a valid pointer to a log.
>
> This prevents the potential invalid dereference reported by smatch:
>
> lib/kunit/debugfs.c:115 kunit_debugfs_create_suite() error: 'suite->log'
> dereferencing possible ERR_PTR()
> lib/kunit/debugfs.c:119 kunit_debugfs_create_suite() error: 'test_case->log'
> dereferencing possible ERR_PTR()
>
> Signed-off-by: Richard Fitzgerald <rf@...nsource.cirrus.com>
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Fixes: 05e2006ce493 ("kunit: Use string_stream for test log")
> ---
Thanks for fixing all the nasty C error handling.
Closes: https://groups.google.com/g/kunit-dev/c/sf6MsFzeEV4
Reviewed-by: David Gow <davidgow@...gle.com>
Cheers,
-- David
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4003 bytes)
Powered by blists - more mailing lists