Skip to content

Commit df3cb7a

Browse files
ojedashuahkh
authored andcommitted
kunit: test-bug.h: include stddef.h for NULL
The header uses `NULL` in both `CONFIG_KUNIT=y` and `=n` cases, but does not include it explicitly. When `CONFIG_KUNIT=y`, the header is already getting included via the other headers, so it is not a problem for users. However, when `CONFIG_KUNIT=n`, it is not, and thus a user could hit a build error when including `kunit/test-bug.h`, like we are doing later in this series [1]. Thus include `linux/stddef.h`, and do so outside the `#if`, since it is used in both cases. Reported-by: Boqun Feng <[email protected]> Closes: https://lore.kernel.org/rust-for-linux/ZJ8cNUW3oR2p+gL1@boqun-archlinux/ [1] Signed-off-by: Miguel Ojeda <[email protected]> Reviewed-by: David Gow <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 1b0975e commit df3cb7a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/kunit/test-bug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef _KUNIT_TEST_BUG_H
1010
#define _KUNIT_TEST_BUG_H
1111

12+
#include <linux/stddef.h> /* for NULL */
13+
1214
#if IS_ENABLED(CONFIG_KUNIT)
1315

1416
#include <linux/jump_label.h> /* For static branch */

0 commit comments

Comments
 (0)