]> git.baikalelectronics.ru Git - kernel.git/commit
kunit: introduce kunit_kmalloc_array/kunit_kcalloc() helpers
authorDaniel Latypov <dlatypov@google.com>
Mon, 3 May 2021 20:58:34 +0000 (13:58 -0700)
committerShuah Khan <skhan@linuxfoundation.org>
Fri, 25 Jun 2021 17:31:03 +0000 (11:31 -0600)
commit55b51cff59f8ded26daa918d319b4411d91fd2ee
tree2015be0047c56ff1b67c1754763eef3810cf868e
parentc6b8f79cba9a2847f9a5aa5d1bf12ae299465fba
kunit: introduce kunit_kmalloc_array/kunit_kcalloc() helpers

Add in:
* kunit_kmalloc_array() and wire up kunit_kmalloc() to be a special
case of it.
* kunit_kcalloc() for symmetry with kunit_kzalloc()

This should using KUnit more natural by making it more similar to the
existing *alloc() APIs.

And while we shouldn't necessarily be writing unit tests where overflow
should be a concern, it can't hurt to be safe.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
include/kunit/test.h
lib/kunit/test.c