[zx2c4-wireguard:jd/new-archs 3/9] arch/um/drivers/tty.c:26:24: error: 'NULL' undeclared

From: kernel test robot
Date: Thu Jul 14 2022 - 06:12:15 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git jd/new-archs
head: b41a21fc924011fb4c7463c8b7b4761dc798e795
commit: 2c1370ee8e1c862e1de8c624d7900d575a131150 [3/9] um: include sys/types.h instead of stddef.h for size_t
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220714/202207141802.1bmhOfxR-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git/commit/?id=2c1370ee8e1c862e1de8c624d7900d575a131150
git remote add zx2c4-wireguard https://git.kernel.org/pub/scm/linux/kernel/git/zx2c4/wireguard-linux.git
git fetch --no-tags zx2c4-wireguard jd/new-archs
git checkout 2c1370ee8e1c862e1de8c624d7900d575a131150
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

arch/um/drivers/tty.c: In function 'tty_chan_init':
>> arch/um/drivers/tty.c:26:24: error: 'NULL' undeclared (first use in this function)
26 | return NULL;
| ^~~~
arch/um/drivers/tty.c:12:1: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
11 | #include <um_malloc.h>
+++ |+#include <stddef.h>
12 |
arch/um/drivers/tty.c:26:24: note: each undeclared identifier is reported only once for each function it appears in
26 | return NULL;
| ^~~~
--
arch/um/drivers/cow_user.c: In function 'read_cow_header':
>> arch/um/drivers/cow_user.c:296:17: error: implicit declaration of function 'offsetof' [-Werror=implicit-function-declaration]
296 | if (n < offsetof(typeof(header->v1), backing_file)) {
| ^~~~~~~~
arch/um/drivers/cow_user.c:17:1: note: 'offsetof' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
16 | #include "cow_sys.h"
+++ |+#include <stddef.h>
17 |
>> arch/um/drivers/cow_user.c:296:26: error: expected expression before 'typeof'
296 | if (n < offsetof(typeof(header->v1), backing_file)) {
| ^~~~~~
cc1: some warnings being treated as errors


vim +/NULL +26 arch/um/drivers/tty.c

^1da177e4c3f415 Linus Torvalds 2005-04-16 18
5e7672ec3f059f7 Jeff Dike 2006-09-27 19 static void *tty_chan_init(char *str, int device, const struct chan_opts *opts)
^1da177e4c3f415 Linus Torvalds 2005-04-16 20 {
^1da177e4c3f415 Linus Torvalds 2005-04-16 21 struct tty_chan *data;
^1da177e4c3f415 Linus Torvalds 2005-04-16 22
^1da177e4c3f415 Linus Torvalds 2005-04-16 23 if (*str != ':') {
e99525f97069004 Jeff Dike 2007-10-16 24 printk(UM_KERN_ERR "tty_init : channel type 'tty' must specify "
^1da177e4c3f415 Linus Torvalds 2005-04-16 25 "a device\n");
108ffa8cbfa323d Jeff Dike 2006-07-10 @26 return NULL;
^1da177e4c3f415 Linus Torvalds 2005-04-16 27 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 28 str++;
^1da177e4c3f415 Linus Torvalds 2005-04-16 29
43f5b3085fdd27c Jeff Dike 2008-05-12 30 data = uml_kmalloc(sizeof(*data), UM_GFP_KERNEL);
^1da177e4c3f415 Linus Torvalds 2005-04-16 31 if (data == NULL)
108ffa8cbfa323d Jeff Dike 2006-07-10 32 return NULL;
^1da177e4c3f415 Linus Torvalds 2005-04-16 33 *data = ((struct tty_chan) { .dev = str,
^1da177e4c3f415 Linus Torvalds 2005-04-16 34 .raw = opts->raw });
^1da177e4c3f415 Linus Torvalds 2005-04-16 35
108ffa8cbfa323d Jeff Dike 2006-07-10 36 return data;
^1da177e4c3f415 Linus Torvalds 2005-04-16 37 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 38

:::::: The code at line 26 was first introduced by commit
:::::: 108ffa8cbfa323d462a2f4b49f38da3205d36e5a [PATCH] uml: formatting fixes

:::::: TO: Jeff Dike <jdike@xxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://01.org/lkp