[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGS_qxqV0Con7XL0P5XVvdJY73aSLWDu_WD+3DKn2UfD+=rsxQ@mail.gmail.com>
Date: Fri, 22 Jul 2022 09:49:02 -0700
From: Daniel Latypov <dlatypov@...gle.com>
To: David Gow <davidgow@...gle.com>
Cc: Brendan Higgins <brendanhiggins@...gle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
KUnit Development <kunit-dev@...glegroups.com>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH 4/4] kunit: make knuit_kfree() not segfault on invalid inputs
On Fri, Jul 22, 2022 at 12:35 AM David Gow <davidgow@...gle.com> wrote:
> _Maybe_ we should no-op if ptr is NULL. I think it's legal for
> free()/kfree(), and while I don't see much use of it for kunit tests,
> maybe it'll save someone confusion down the road.
>
> But I could live with it either way...
That's a good point.
kfree(NULL) is indeed a no-op.
I can see someone writing a parameterized test w/ some code like
char *buffer = NULL;
if (param->use_buffer) buffer = kunit_kzalloc(test, 10, GFP_KERNEL);
...
kunit_kfree(test, buffer);
and they'd have every reason to think this should just work.
I think I'll tack this on as an extra patch and send a v2 w/ the
commit subject for this one fixed.
Powered by blists - more mailing lists