Skip to contentSkip to conversation

uapi: Make generic uapi headers compile standalone.

PATCH In review Jayant Chowdhary 4 participants 10 messages Jun 6, 2018 – Jun 8, 2018

Subsystems (17)
Networking Media (V4L/DVB) SCSI Sound +13 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uapi: Make generic uapi headers compile standalone.

In order for static analysis tools to analyze each of the uapi headers, we need to enable them to compile stand-alone. Some uapi headers were missing dependencies which would not make them compile stand-alone in user-land. This patch adds those dependencies.

Test: make defconfig; make -j64

Test: make ARCH=arm64 defconfig;
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j64 all

Test: ran header-abi-dumper[1] on all the affected headers with
appropriate include paths[2] for arm64. eg: for drm_fourcc.h,

$HEADER_ABI_DUMPER -o drm_fourcc.h.sdump \
include/uapi/drm/drm_fourcc.h -- -target aarch64-linux-android -std=gnu99 \
-isystem $CLANG_INCLUDE_PATH \
-I include/uapi/ -I arch/arm64/include/generated/uapi \
-I arch/arm64/include/uapi -I private-compiler-headers
-I include/generated/uapi \
-I include/uapi/../../arch/arm/include/uapi

where
HEADER_ABI_DUMPER=\
$ANDROID_BUILD_TOP/prebuilts/clang-tools/linux-x86/bin/header-abi-dumper

CLANG_INCLUDE_PATH=\
$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-3289846/bin/../lib64/clang/3.8/include

on a lunched aosp tree [3]

[1]
header-abi-dumper is a clang based static analysis tool, used by android's build system which parses a C/C++ source file and emits information about the data types included in the source. More information can be found at
https://android.googlesource.com/platform/development/+/master/vndk/tools/header-checker/README.md

[2]
Some headers, eg: compiler_types.h, compiler.h, sys/socket.h are not in the set of uapi headers, even though they are included by uapi headers( include/uapi/linux/types.h, include/uapi/asm-generic/signal-defs.h etc). The 'private-compiler-headers' in the test clause was included with private copies of these headers. libc distributions (eg: bionic) often have their copies of these headers as well.

[3]
https://source.android.com/setup/build/downloading

---
 include/uapi/asm-generic/ipcbuf.h              | 2 ++
 include/uapi/asm-generic/msgbuf.h              | 3 +++
 include/uapi/asm-generic/sembuf.h              | 2 ++
 include/uapi/asm-generic/shmbuf.h              | 2 ++
 include/uapi/asm-generic/ucontext.h            | 5 +++++
 include/uapi/linux/agpgart.h                   | 1 -
 include/uapi/linux/android/binder.h            | 1 +
 include/uapi/linux/chio.h                      | 6 ++++++
 include/uapi/linux/coda_psdev.h                | 1 +
 include/uapi/linux/dvb/dmx.h                   | 3 ---
 include/uapi/linux/dvb/video.h                 | 3 ---
 include/uapi/linux/errqueue.h                  | 1 +
 include/uapi/linux/kexec.h                     | 1 +
 include/uapi/linux/kfd_ioctl.h                 | 1 +
 include/uapi/linux/lightnvm.h                  | 1 -
 include/uapi/linux/ndctl.h                     | 1 +
 include/uapi/linux/netfilter_bridge/ebtables.h | 1 +
 include/uapi/linux/nfs4_mount.h                | 3 +++
 include/uapi/linux/psp-sev.h                   | 1 +
 include/uapi/linux/scc.h                       | 2 +-
 include/uapi/linux/sctp.h                      | 3 +++
 include/uapi/linux/sdla.h                      | 2 ++
 include/uapi/linux/socket.h                    | 4 ++++
 include/uapi/linux/stddef.h                    | 5 +++++
 include/uapi/linux/sysctl.h                    | 1 +
 include/uapi/linux/types.h                     | 1 +
 include/uapi/linux/vbox_vmmdev_types.h         | 1 +
 include/uapi/linux/vboxguest.h                 | 1 +
 include/uapi/rdma/hfi/hfi1_user.h              | 1 +
 include/uapi/scsi/scsi_bsg_fc.h                | 2 ++
 include/uapi/scsi/scsi_netlink.h               | 1 +
 include/uapi/sound/asound.h                    | 2 +-
 32 files changed, 55 insertions(+), 10 deletions(-)
include/uapi/asm-generic/ipcbuf.h +2 -0
index 7d80dbd336fb..41a01b494fc7 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_GENERIC_IPCBUF_H
 #define __ASM_GENERIC_IPCBUF_H
 
+#include <linux/posix_types.h>
+
 /*
  * The generic ipc64_perm structure:
  * Note extra padding because this structure is passed back and forth
include/uapi/asm-generic/msgbuf.h +3 -0
index fb306ebdb36f..8cdd7ca75df6 100644
@@ -3,6 +3,9 @@
 #define __ASM_GENERIC_MSGBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <linux/posix_types.h>
+
 /*
  * generic msqid64_ds structure.
  *
include/uapi/asm-generic/sembuf.h +2 -0
index cbf9cfe977d6..7f37edb95d9f 100644
@@ -3,6 +3,8 @@
 #define __ASM_GENERIC_SEMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <linux/posix_types.h>
 
 /*
  * The semid64_ds structure for x86 architecture.
include/uapi/asm-generic/shmbuf.h +2 -0
index 2b6c3bb97f97..1c5e7165fca5 100644
@@ -3,6 +3,8 @@
 #define __ASM_GENERIC_SHMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <stddef.h>
 
 /*
  * The shmid64_ds structure for x86 architecture.
include/uapi/asm-generic/ucontext.h +5 -0
index 351868a72168..19199f45c523 100644
@@ -2,6 +2,11 @@
 #ifndef __ASM_GENERIC_UCONTEXT_H
 #define __ASM_GENERIC_UCONTEXT_H
 
+#ifndef __KERNEL__
+#include <asm-generic/signal.h>
+#include <asm/sigcontext.h>
+#endif
+
 struct ucontext {
 	unsigned long	  uc_flags;
 	struct ucontext  *uc_link;
include/uapi/linux/agpgart.h +0 -1
index f5251045181a..4e828cf487bc 100644
@@ -52,7 +52,6 @@
 
 #ifndef __KERNEL__
 #include <linux/types.h>
-#include <stdlib.h>
 
 struct agp_version {
 	__u16 major;
include/uapi/linux/android/binder.h +1 -0
index bfaec6903b8b..fd6de2203057 100644
@@ -23,6 +23,7 @@
 
 #include <linux/types.h>
 #include <linux/ioctl.h>
+#include <sys/types.h>
 
 #define B_PACK_CHARS(c1, c2, c3, c4) \
 	((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
include/uapi/linux/chio.h +6 -0
index 689fc93fafda..5e63753a0d53 100644
@@ -3,6 +3,11 @@
  * ioctl interface for the scsi media changer driver
  */
 
+#ifndef _UAPI_CHIO_H
+#define _UAPI_CHIO_H
+
+#include <linux/compiler.h>
+
 /* changer element types */
 #define CHET_MT   0	/* media transport element (robot) */
 #define CHET_ST   1	/* storage element (media slots) */
@@ -167,3 +172,4 @@ struct changer_set_voltag {
  * c-basic-offset: 8
  * End:
  */
+#endif
include/uapi/linux/coda_psdev.h +1 -0
index aa6623efd2dd..31b1867021b7 100644
@@ -3,6 +3,7 @@
 #define _UAPI__CODA_PSDEV_H
 
 #include <linux/magic.h>
+#include <sys/types.h>
 
 #define CODA_PSDEV_MAJOR 67
 #define MAX_CODADEVS  5	   /* how many do we allow */
include/uapi/linux/dvb/dmx.h +0 -3
index b4112f0b6dd3..ce30e9f6145a 100644
@@ -26,9 +26,6 @@
 #define _UAPI_DVBDMX_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <time.h>
-#endif
 
 
 #define DMX_FILTER_SIZE 16
include/uapi/linux/dvb/video.h +0 -3
index df3d7028c807..8f3a485b9988 100644
@@ -26,9 +26,6 @@
 #define _UAPI_DVBVIDEO_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <time.h>
-#endif
 
 typedef enum {
 	VIDEO_FORMAT_4_3,     /* Select 4:3 format */
include/uapi/linux/errqueue.h +1 -0
index dc64cfaf13da..ad2421e3d613 100644
@@ -2,6 +2,7 @@
 #ifndef _UAPI_LINUX_ERRQUEUE_H
 #define _UAPI_LINUX_ERRQUEUE_H
 
+#include <linux/time.h>
 #include <linux/types.h>
 
 struct sock_extended_err {
include/uapi/linux/kexec.h +1 -0
index 6d112868272d..49d50d469723 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <stddef.h>
 
 /* kexec flags for different usage scenarios */
 #define KEXEC_ON_CRASH		0x00000001
include/uapi/linux/kfd_ioctl.h +1 -0
index b4f5073dbac2..4a882a133b69 100644
@@ -25,6 +25,7 @@
 
 #include <drm/drm.h>
 #include <linux/ioctl.h>
+#include <stdint.h>
 
 #define KFD_IOCTL_MAJOR_VERSION 1
 #define KFD_IOCTL_MINOR_VERSION 1
include/uapi/linux/lightnvm.h +0 -1
index f9a1be7fc696..af28d32b0ac3 100644
@@ -24,7 +24,6 @@
 #include <linux/kernel.h>
 #include <linux/ioctl.h>
 #else /* __KERNEL__ */
-#include <stdio.h>
 #include <sys/ioctl.h>
 #define DISK_NAME_LEN 32
 #endif /* __KERNEL__ */
include/uapi/linux/ndctl.h +1 -0
index 7e27070b9440..a89a294e5ca5 100644
@@ -13,6 +13,7 @@
 #ifndef __NDCTL_H__
 #define __NDCTL_H__
 
+#include <linux/compiler.h>
 #include <linux/types.h>
 
 struct nd_cmd_dimm_flags {
include/uapi/linux/netfilter_bridge/ebtables.h +1 -0
index 0c7dc8315013..c57850b90b50 100644
@@ -16,6 +16,7 @@
 #include <linux/types.h>
 #include <linux/if.h>
 #include <linux/netfilter_bridge.h>
+#include <stdint.h>
 
 #define EBT_TABLE_MAXNAMELEN 32
 #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
include/uapi/linux/nfs4_mount.h +3 -0
index d20bb869bb99..6c9792073b19 100644
@@ -19,6 +19,9 @@
  */
 #define NFS4_MOUNT_VERSION	1
 
+#include <linux/socket.h> /* for struct sockaddr. */
+#include <linux/compiler.h>
+
 struct nfs_string {
 	unsigned int len;
 	const char __user * data;
include/uapi/linux/psp-sev.h +1 -0
index 9008f31c7eb6..c796f1b194a3 100644
@@ -18,6 +18,7 @@
 #define __PSP_SEV_USER_H__
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /**
  * SEV platform commands
include/uapi/linux/scc.h +1 -1
index c5bc7f747755..9122d48a4227 100644
@@ -4,7 +4,7 @@
 #ifndef _UAPI_SCC_H
 #define _UAPI_SCC_H
 
-
+#include <linux/sockios.h>
 /* selection of hardware types */
 
 #define PA0HZP		0x00	/* hardware type for PA0HZP SCC card and compatible */
include/uapi/linux/sctp.h +3 -0
index b64d583bf053..de4675d92e9f 100644
@@ -56,6 +56,9 @@
 
 #include <linux/types.h>
 #include <linux/socket.h>
+#ifndef __KERNEL__
+#include <stdint.h>
+#endif
 
 typedef __s32 sctp_assoc_t;
 
include/uapi/linux/sdla.h +2 -0
index 1e3735be6511..2a0dc687aa49 100644
@@ -24,6 +24,8 @@
 #ifndef _UAPISDLA_H
 #define _UAPISDLA_H
 
+#include <linux/compiler.h>
+
 /* adapter type */
 #define SDLA_TYPES
 #define SDLA_S502A			5020
include/uapi/linux/socket.h +4 -0
index 8eb96021709c..51c11f6b26e6 100644
@@ -11,6 +11,10 @@
 
 typedef unsigned short __kernel_sa_family_t;
 
+#ifndef __KERNEL__
+#include <sys/socket.h>			/* for struct sockaddr.		*/
+#endif
+
 struct __kernel_sockaddr_storage {
 	__kernel_sa_family_t	ss_family;		/* address family */
 	/* Following field(s) are implementation specific */
include/uapi/linux/stddef.h +5 -0
index ee8220f8dcf5..c949a6836417 100644
@@ -1,6 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __UAPI_STDDEF_H__
+#define __UAPI_STDDEF_H__
+
 #include <linux/compiler_types.h>
 
 #ifndef __always_inline
 #define __always_inline inline
 #endif
+
+#endif // __UAPI_STDDEF_H__
include/uapi/linux/sysctl.h +1 -0
index 6b58371b1f0d..fac6c1c7def2 100644
@@ -26,6 +26,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <stddef.h>
 
 #define CTL_MAXNAME 10		/* how many path components do we allow in a
 				   call to sysctl?   In other words, what is
include/uapi/linux/types.h +1 -0
index cd4f0b897a48..d61eb82432be 100644
@@ -11,6 +11,7 @@
 #endif /* __EXPORTED_HEADERS__ */
 #endif
 
+#include <linux/compiler_types.h>
 #include <linux/posix_types.h>
 
 
include/uapi/linux/vbox_vmmdev_types.h +1 -0
index 0e68024f36c7..26d0e69f6fdc 100644
@@ -11,6 +11,7 @@
 
 #include <asm/bitsperlong.h>
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /*
  * We cannot use linux' compiletime_assert here because it expects to be used
include/uapi/linux/vboxguest.h +1 -0
index 612f0c7d3558..44606c96f830 100644
@@ -9,6 +9,7 @@
 #define __UAPI_VBOXGUEST_H__
 
 #include <asm/bitsperlong.h>
+#include <linux/compiler.h>
 #include <linux/ioctl.h>
 #include <linux/vbox_err.h>
 #include <linux/vbox_vmmdev_types.h>
include/uapi/rdma/hfi/hfi1_user.h +1 -0
index c6a984c0c881..6f5e461b8015 100644
@@ -58,6 +58,7 @@
 #define _LINUX__HFI1_USER_H
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 #include <rdma/rdma_user_ioctl.h>
 
 /*
include/uapi/scsi/scsi_bsg_fc.h +2 -0
index 62597d86beed..23971d00c46d 100644
@@ -23,6 +23,8 @@
 #ifndef SCSI_BSG_FC_H
 #define SCSI_BSG_FC_H
 
+#include <stdint.h>
+
 /*
  * This file intended to be included by both kernel and user space
  */
include/uapi/scsi/scsi_netlink.h +1 -0
index 5ccc2333acab..37d39eb671cc 100644
@@ -25,6 +25,7 @@
 
 #include <linux/netlink.h>
 #include <linux/types.h>
+#include <stdint.h>
 
 /*
  * This file intended to be included by both kernel and user space
include/uapi/sound/asound.h +1 -1
index ed0a120d4f08..b569f0eb3a7f 100644
@@ -31,7 +31,7 @@
 #endif
 
 #ifndef __KERNEL__
-#include <stdlib.h>
+#include<linux/time.h>
 #endif
 
 /*
Signature · 1 line
2.17.1.1185.g55be947832-goog
#1 lore raw

Hi.

2018-06-07 8:16 GMT+09:00 Jayant Chowdhary <[email protected]>:

Quoted 15 lines

In order for static analysis tools to analyze each of the uapi headers, we need to enable them to compile stand-alone. Some uapi headers were missing dependencies which would not make them compile stand-alone in user-land. This patch adds those dependencies.

Test: make defconfig; make -j64

Test: make ARCH=arm64 defconfig;
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j64 all

Test: ran header-abi-dumper[1] on all the affected headers with
appropriate include paths[2] for arm64. eg: for drm_fourcc.h,

$HEADER_ABI_DUMPER -o drm_fourcc.h.sdump \
include/uapi/drm/drm_fourcc.h -- -target aarch64-linux-android -std=gnu99 \

Review

Quoted 5 lines
(quoted diff) +0 -5
-isystem $CLANG_INCLUDE_PATH \
-I include/uapi/ -I arch/arm64/include/generated/uapi \
-I arch/arm64/include/uapi -I private-compiler-headers
-I include/generated/uapi \
-I include/uapi/../../arch/arm/include/uapi

First of all, is this check sensible?

scripts/headers_install.sh manipulates exported headers.

So, shouldn't you do this check after "make headers_install"?

You are adding around <linux/compiler.h> to various UAPI headers. Could you tell me why it was added?

The tool rips off <linux/compiler.h> anyway when exporting UAPI headers:
https://github.com/torvalds/linux/blob/v4.17/scripts/headers_install.sh#L37

Also, you are adding <stdint.h> to several headers. Please do not pull it in to the kernel space.
The kernel space defines fixed-width types in its headers.

For example, you added <stdint.h> to include/uapi/scsi/scsi_netlink.h

In my opinion, the correct fix is to replace uint8_t with __u8 or __uint8_t.

Quoted 493 lines

where
HEADER_ABI_DUMPER=\
$ANDROID_BUILD_TOP/prebuilts/clang-tools/linux-x86/bin/header-abi-dumper

CLANG_INCLUDE_PATH=\
$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-3289846/bin/../lib64/clang/3.8/include

on a lunched aosp tree [3]

[1]
header-abi-dumper is a clang based static analysis tool, used by android's build system which parses a C/C++ source file and emits information about the data types included in the source. More information can be found at
https://android.googlesource.com/platform/development/+/master/vndk/tools/header-checker/README.md

[2]
Some headers, eg: compiler_types.h, compiler.h, sys/socket.h are not in the set of uapi headers, even though they are included by uapi headers( include/uapi/linux/types.h, include/uapi/asm-generic/signal-defs.h etc). The 'private-compiler-headers' in the test clause was included with private copies of these headers. libc distributions (eg: bionic) often have their copies of these headers as well.

[3]
https://source.android.com/setup/build/downloading

---
 include/uapi/asm-generic/ipcbuf.h              | 2 ++
 include/uapi/asm-generic/msgbuf.h              | 3 +++
 include/uapi/asm-generic/sembuf.h              | 2 ++
 include/uapi/asm-generic/shmbuf.h              | 2 ++
 include/uapi/asm-generic/ucontext.h            | 5 +++++
 include/uapi/linux/agpgart.h                   | 1 -
 include/uapi/linux/android/binder.h            | 1 +
 include/uapi/linux/chio.h                      | 6 ++++++
 include/uapi/linux/coda_psdev.h                | 1 +
 include/uapi/linux/dvb/dmx.h                   | 3 ---
 include/uapi/linux/dvb/video.h                 | 3 ---
 include/uapi/linux/errqueue.h                  | 1 +
 include/uapi/linux/kexec.h                     | 1 +
 include/uapi/linux/kfd_ioctl.h                 | 1 +
 include/uapi/linux/lightnvm.h                  | 1 -
 include/uapi/linux/ndctl.h                     | 1 +
 include/uapi/linux/netfilter_bridge/ebtables.h | 1 +
 include/uapi/linux/nfs4_mount.h                | 3 +++
 include/uapi/linux/psp-sev.h                   | 1 +
 include/uapi/linux/scc.h                       | 2 +-
 include/uapi/linux/sctp.h                      | 3 +++
 include/uapi/linux/sdla.h                      | 2 ++
 include/uapi/linux/socket.h                    | 4 ++++
 include/uapi/linux/stddef.h                    | 5 +++++
 include/uapi/linux/sysctl.h                    | 1 +
 include/uapi/linux/types.h                     | 1 +
 include/uapi/linux/vbox_vmmdev_types.h         | 1 +
 include/uapi/linux/vboxguest.h                 | 1 +
 include/uapi/rdma/hfi/hfi1_user.h              | 1 +
 include/uapi/scsi/scsi_bsg_fc.h                | 2 ++
 include/uapi/scsi/scsi_netlink.h               | 1 +
 include/uapi/sound/asound.h                    | 2 +-
 32 files changed, 55 insertions(+), 10 deletions(-)
include/uapi/asm-generic/ipcbuf.h +2 -0
index 7d80dbd336fb..41a01b494fc7 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_GENERIC_IPCBUF_H
 #define __ASM_GENERIC_IPCBUF_H
 
+#include <linux/posix_types.h>
+
 /*
  * The generic ipc64_perm structure:
  * Note extra padding because this structure is passed back and forth
include/uapi/asm-generic/msgbuf.h +3 -0
index fb306ebdb36f..8cdd7ca75df6 100644
@@ -3,6 +3,9 @@
 #define __ASM_GENERIC_MSGBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <linux/posix_types.h>
+
 /*
  * generic msqid64_ds structure.
  *
include/uapi/asm-generic/sembuf.h +2 -0
index cbf9cfe977d6..7f37edb95d9f 100644
@@ -3,6 +3,8 @@
 #define __ASM_GENERIC_SEMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <linux/posix_types.h>
 
 /*
  * The semid64_ds structure for x86 architecture.
include/uapi/asm-generic/shmbuf.h +2 -0
index 2b6c3bb97f97..1c5e7165fca5 100644
@@ -3,6 +3,8 @@
 #define __ASM_GENERIC_SHMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <stddef.h>
 
 /*
  * The shmid64_ds structure for x86 architecture.
include/uapi/asm-generic/ucontext.h +5 -0
index 351868a72168..19199f45c523 100644
@@ -2,6 +2,11 @@
 #ifndef __ASM_GENERIC_UCONTEXT_H
 #define __ASM_GENERIC_UCONTEXT_H
 
+#ifndef __KERNEL__
+#include <asm-generic/signal.h>
+#include <asm/sigcontext.h>
+#endif
+
 struct ucontext {
        unsigned long     uc_flags;
        struct ucontext  *uc_link;
include/uapi/linux/agpgart.h +0 -1
index f5251045181a..4e828cf487bc 100644
@@ -52,7 +52,6 @@
 
 #ifndef __KERNEL__
 #include <linux/types.h>
-#include <stdlib.h>
 
 struct agp_version {
        __u16 major;
include/uapi/linux/android/binder.h +1 -0
index bfaec6903b8b..fd6de2203057 100644
@@ -23,6 +23,7 @@
 
 #include <linux/types.h>
 #include <linux/ioctl.h>
+#include <sys/types.h>
 
 #define B_PACK_CHARS(c1, c2, c3, c4) \
        ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
include/uapi/linux/chio.h +6 -0
index 689fc93fafda..5e63753a0d53 100644
@@ -3,6 +3,11 @@
  * ioctl interface for the scsi media changer driver
  */
 
+#ifndef _UAPI_CHIO_H
+#define _UAPI_CHIO_H
+
+#include <linux/compiler.h>
+
 /* changer element types */
 #define CHET_MT   0    /* media transport element (robot) */
 #define CHET_ST   1    /* storage element (media slots) */
@@ -167,3 +172,4 @@ struct changer_set_voltag {
  * c-basic-offset: 8
  * End:
  */
+#endif
include/uapi/linux/coda_psdev.h +1 -0
index aa6623efd2dd..31b1867021b7 100644
@@ -3,6 +3,7 @@
 #define _UAPI__CODA_PSDEV_H
 
 #include <linux/magic.h>
+#include <sys/types.h>
 
 #define CODA_PSDEV_MAJOR 67
 #define MAX_CODADEVS  5           /* how many do we allow */
include/uapi/linux/dvb/dmx.h +0 -3
index b4112f0b6dd3..ce30e9f6145a 100644
@@ -26,9 +26,6 @@
 #define _UAPI_DVBDMX_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <time.h>
-#endif
 
 
 #define DMX_FILTER_SIZE 16
include/uapi/linux/dvb/video.h +0 -3
index df3d7028c807..8f3a485b9988 100644
@@ -26,9 +26,6 @@
 #define _UAPI_DVBVIDEO_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <time.h>
-#endif
 
 typedef enum {
        VIDEO_FORMAT_4_3,     /* Select 4:3 format */
include/uapi/linux/errqueue.h +1 -0
index dc64cfaf13da..ad2421e3d613 100644
@@ -2,6 +2,7 @@
 #ifndef _UAPI_LINUX_ERRQUEUE_H
 #define _UAPI_LINUX_ERRQUEUE_H
 
+#include <linux/time.h>
 #include <linux/types.h>
 
 struct sock_extended_err {
include/uapi/linux/kexec.h +1 -0
index 6d112868272d..49d50d469723 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <stddef.h>
 
 /* kexec flags for different usage scenarios */
 #define KEXEC_ON_CRASH         0x00000001
include/uapi/linux/kfd_ioctl.h +1 -0
index b4f5073dbac2..4a882a133b69 100644
@@ -25,6 +25,7 @@
 
 #include <drm/drm.h>
 #include <linux/ioctl.h>
+#include <stdint.h>
 
 #define KFD_IOCTL_MAJOR_VERSION 1
 #define KFD_IOCTL_MINOR_VERSION 1
include/uapi/linux/lightnvm.h +0 -1
index f9a1be7fc696..af28d32b0ac3 100644
@@ -24,7 +24,6 @@
 #include <linux/kernel.h>
 #include <linux/ioctl.h>
 #else /* __KERNEL__ */
-#include <stdio.h>
 #include <sys/ioctl.h>
 #define DISK_NAME_LEN 32
 #endif /* __KERNEL__ */
include/uapi/linux/ndctl.h +1 -0
index 7e27070b9440..a89a294e5ca5 100644
@@ -13,6 +13,7 @@
 #ifndef __NDCTL_H__
 #define __NDCTL_H__
 
+#include <linux/compiler.h>
 #include <linux/types.h>
 
 struct nd_cmd_dimm_flags {
include/uapi/linux/netfilter_bridge/ebtables.h +1 -0
index 0c7dc8315013..c57850b90b50 100644
@@ -16,6 +16,7 @@
 #include <linux/types.h>
 #include <linux/if.h>
 #include <linux/netfilter_bridge.h>
+#include <stdint.h>
 
 #define EBT_TABLE_MAXNAMELEN 32
 #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
include/uapi/linux/nfs4_mount.h +3 -0
index d20bb869bb99..6c9792073b19 100644
@@ -19,6 +19,9 @@
  */
 #define NFS4_MOUNT_VERSION     1
 
+#include <linux/socket.h> /* for struct sockaddr. */
+#include <linux/compiler.h>
+
 struct nfs_string {
        unsigned int len;
        const char __user * data;
include/uapi/linux/psp-sev.h +1 -0
index 9008f31c7eb6..c796f1b194a3 100644
@@ -18,6 +18,7 @@
 #define __PSP_SEV_USER_H__
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /**
  * SEV platform commands
include/uapi/linux/scc.h +1 -1
index c5bc7f747755..9122d48a4227 100644
@@ -4,7 +4,7 @@
 #ifndef _UAPI_SCC_H
 #define _UAPI_SCC_H
 
-
+#include <linux/sockios.h>
 /* selection of hardware types */
 
 #define PA0HZP         0x00    /* hardware type for PA0HZP SCC card and compatible */
include/uapi/linux/sctp.h +3 -0
index b64d583bf053..de4675d92e9f 100644
@@ -56,6 +56,9 @@
 
 #include <linux/types.h>
 #include <linux/socket.h>
+#ifndef __KERNEL__
+#include <stdint.h>
+#endif
 
 typedef __s32 sctp_assoc_t;
 
include/uapi/linux/sdla.h +2 -0
index 1e3735be6511..2a0dc687aa49 100644
@@ -24,6 +24,8 @@
 #ifndef _UAPISDLA_H
 #define _UAPISDLA_H
 
+#include <linux/compiler.h>
+
 /* adapter type */
 #define SDLA_TYPES
 #define SDLA_S502A                     5020
include/uapi/linux/socket.h +4 -0
index 8eb96021709c..51c11f6b26e6 100644
@@ -11,6 +11,10 @@
 
 typedef unsigned short __kernel_sa_family_t;
 
+#ifndef __KERNEL__
+#include <sys/socket.h>                        /* for struct sockaddr.         */
+#endif
+
 struct __kernel_sockaddr_storage {
        __kernel_sa_family_t    ss_family;              /* address family */
        /* Following field(s) are implementation specific */
include/uapi/linux/stddef.h +5 -0
index ee8220f8dcf5..c949a6836417 100644
@@ -1,6 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __UAPI_STDDEF_H__
+#define __UAPI_STDDEF_H__
+
 #include <linux/compiler_types.h>
 
 #ifndef __always_inline
 #define __always_inline inline
 #endif
+
+#endif // __UAPI_STDDEF_H__
include/uapi/linux/sysctl.h +1 -0
index 6b58371b1f0d..fac6c1c7def2 100644
@@ -26,6 +26,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <stddef.h>
 
 #define CTL_MAXNAME 10         /* how many path components do we allow in a
                                   call to sysctl?   In other words, what is
include/uapi/linux/types.h +1 -0
index cd4f0b897a48..d61eb82432be 100644
@@ -11,6 +11,7 @@
 #endif /* __EXPORTED_HEADERS__ */
 #endif
 
+#include <linux/compiler_types.h>
 #include <linux/posix_types.h>
 
 
include/uapi/linux/vbox_vmmdev_types.h +1 -0
index 0e68024f36c7..26d0e69f6fdc 100644
@@ -11,6 +11,7 @@
 
 #include <asm/bitsperlong.h>
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /*
  * We cannot use linux' compiletime_assert here because it expects to be used
include/uapi/linux/vboxguest.h +1 -0
index 612f0c7d3558..44606c96f830 100644
@@ -9,6 +9,7 @@
 #define __UAPI_VBOXGUEST_H__
 
 #include <asm/bitsperlong.h>
+#include <linux/compiler.h>
 #include <linux/ioctl.h>
 #include <linux/vbox_err.h>
 #include <linux/vbox_vmmdev_types.h>
include/uapi/rdma/hfi/hfi1_user.h +1 -0
index c6a984c0c881..6f5e461b8015 100644
@@ -58,6 +58,7 @@
 #define _LINUX__HFI1_USER_H
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 #include <rdma/rdma_user_ioctl.h>
 
 /*
include/uapi/scsi/scsi_bsg_fc.h +2 -0
index 62597d86beed..23971d00c46d 100644
@@ -23,6 +23,8 @@
 #ifndef SCSI_BSG_FC_H
 #define SCSI_BSG_FC_H
 
+#include <stdint.h>
+
 /*
  * This file intended to be included by both kernel and user space
  */
include/uapi/scsi/scsi_netlink.h +1 -0
index 5ccc2333acab..37d39eb671cc 100644
@@ -25,6 +25,7 @@
 
 #include <linux/netlink.h>
 #include <linux/types.h>
+#include <stdint.h>
 
 /*
  * This file intended to be included by both kernel and user space
include/uapi/sound/asound.h +1 -2
index ed0a120d4f08..b569f0eb3a7f 100644
@@ -31,7 +31,7 @@
 #endif
 
 #ifndef __KERNEL__
-#include <stdlib.h>
+#include<linux/time.h>
 #endif
 
 /*
--

2.17.1.1185.g55be947832-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Best Regards
Masahiro Yamada
#2 lore raw

Hi,

Quoted 28 lines · Masahiro Yamada

Hi.

2018-06-07 8:16 GMT+09:00 Jayant Chowdhary <[email protected]>:

Quoted 15 lines

In order for static analysis tools to analyze each of the uapi headers, we need to enable them to compile stand-alone. Some uapi headers were missing dependencies which would not make them compile stand-alone in user-land. This patch adds those dependencies.

Test: make defconfig; make -j64

Test: make ARCH=arm64 defconfig;
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j64 all

Test: ran header-abi-dumper[1] on all the affected headers with
appropriate include paths[2] for arm64. eg: for drm_fourcc.h,

$HEADER_ABI_DUMPER -o drm_fourcc.h.sdump \
include/uapi/drm/drm_fourcc.h -- -target aarch64-linux-android -std=gnu99 \

Review

Quoted 5 lines
(quoted diff) +0 -5
-isystem $CLANG_INCLUDE_PATH \
-I include/uapi/ -I arch/arm64/include/generated/uapi \
-I arch/arm64/include/uapi -I private-compiler-headers
-I include/generated/uapi \
-I include/uapi/../../arch/arm/include/uapi

First of all, is this check sensible?

Quoted 5 lines

scripts/headers_install.sh manipulates exported headers.

So, shouldn't you do this check after "make headers_install"?

Apologies, I was unaware of this. Now it is obvious that this check is not sensible :) The headers which should be checked are the ones 'make headers install' produces and not the ones being checked currently. I'll fix this in the next version of this patch.

Quoted 8 lines

You are adding around <linux/compiler.h> to various UAPI headers. Could you tell me why it was added?

The tool rips off <linux/compiler.h> anyway when exporting UAPI headers:
https://github.com/torvalds/linux/blob/v4.17/scripts/headers_install.sh#L37

I had added these to satisfy the defines included from <linux/compiler.h>, however, since headers_install.sh removes the #includes and the defines themselves, these additions should not be needed.

Quoted 11 lines

Also, you are adding <stdint.h> to several headers. Please do not pull it in to the kernel space.
The kernel space defines fixed-width types in its headers.

For example, you added <stdint.h> to include/uapi/scsi/scsi_netlink.h

In my opinion, the correct fix is to replace uint8_t with __u8 or __uint8_t.

Sure, I will correct this.

Thanks,
Jayant

Quoted 500 lines
Quoted 497 lines

where
HEADER_ABI_DUMPER=\
$ANDROID_BUILD_TOP/prebuilts/clang-tools/linux-x86/bin/header-abi-dumper

CLANG_INCLUDE_PATH=\
$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-3289846/bin/../lib64/clang/3.8/include

on a lunched aosp tree [3]

[1]
header-abi-dumper is a clang based static analysis tool, used by android's build system which parses a C/C++ source file and emits information about the data types included in the source. More information can be found at
https://android.googlesource.com/platform/development/+/master/vndk/tools/header-checker/README.md

[2]
Some headers, eg: compiler_types.h, compiler.h, sys/socket.h are not in the set of uapi headers, even though they are included by uapi headers( include/uapi/linux/types.h, include/uapi/asm-generic/signal-defs.h etc). The 'private-compiler-headers' in the test clause was included with private copies of these headers. libc distributions (eg: bionic) often have their copies of these headers as well.

[3]
https://source.android.com/setup/build/downloading

---
 include/uapi/asm-generic/ipcbuf.h              | 2 ++
 include/uapi/asm-generic/msgbuf.h              | 3 +++
 include/uapi/asm-generic/sembuf.h              | 2 ++
 include/uapi/asm-generic/shmbuf.h              | 2 ++
 include/uapi/asm-generic/ucontext.h            | 5 +++++
 include/uapi/linux/agpgart.h                   | 1 -
 include/uapi/linux/android/binder.h            | 1 +
 include/uapi/linux/chio.h                      | 6 ++++++
 include/uapi/linux/coda_psdev.h                | 1 +
 include/uapi/linux/dvb/dmx.h                   | 3 ---
 include/uapi/linux/dvb/video.h                 | 3 ---
 include/uapi/linux/errqueue.h                  | 1 +
 include/uapi/linux/kexec.h                     | 1 +
 include/uapi/linux/kfd_ioctl.h                 | 1 +
 include/uapi/linux/lightnvm.h                  | 1 -
 include/uapi/linux/ndctl.h                     | 1 +
 include/uapi/linux/netfilter_bridge/ebtables.h | 1 +
 include/uapi/linux/nfs4_mount.h                | 3 +++
 include/uapi/linux/psp-sev.h                   | 1 +
 include/uapi/linux/scc.h                       | 2 +-
 include/uapi/linux/sctp.h                      | 3 +++
 include/uapi/linux/sdla.h                      | 2 ++
 include/uapi/linux/socket.h                    | 4 ++++
 include/uapi/linux/stddef.h                    | 5 +++++
 include/uapi/linux/sysctl.h                    | 1 +
 include/uapi/linux/types.h                     | 1 +
 include/uapi/linux/vbox_vmmdev_types.h         | 1 +
 include/uapi/linux/vboxguest.h                 | 1 +
 include/uapi/rdma/hfi/hfi1_user.h              | 1 +
 include/uapi/scsi/scsi_bsg_fc.h                | 2 ++
 include/uapi/scsi/scsi_netlink.h               | 1 +
 include/uapi/sound/asound.h                    | 2 +-
 32 files changed, 55 insertions(+), 10 deletions(-)
include/uapi/asm-generic/ipcbuf.h +2 -0
index 7d80dbd336fb..41a01b494fc7 100644
@@ -2,6 +2,8 @@
 #ifndef __ASM_GENERIC_IPCBUF_H
 #define __ASM_GENERIC_IPCBUF_H
 
+#include <linux/posix_types.h>
+
 /*
  * The generic ipc64_perm structure:
  * Note extra padding because this structure is passed back and forth
include/uapi/asm-generic/msgbuf.h +3 -0
index fb306ebdb36f..8cdd7ca75df6 100644
@@ -3,6 +3,9 @@
 #define __ASM_GENERIC_MSGBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <linux/posix_types.h>
+
 /*
  * generic msqid64_ds structure.
  *
include/uapi/asm-generic/sembuf.h +2 -0
index cbf9cfe977d6..7f37edb95d9f 100644
@@ -3,6 +3,8 @@
 #define __ASM_GENERIC_SEMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <linux/posix_types.h>
 
 /*
  * The semid64_ds structure for x86 architecture.
include/uapi/asm-generic/shmbuf.h +2 -0
index 2b6c3bb97f97..1c5e7165fca5 100644
@@ -3,6 +3,8 @@
 #define __ASM_GENERIC_SHMBUF_H
 
 #include <asm/bitsperlong.h>
+#include <asm-generic/ipcbuf.h>
+#include <stddef.h>
 
 /*
  * The shmid64_ds structure for x86 architecture.
include/uapi/asm-generic/ucontext.h +5 -0
index 351868a72168..19199f45c523 100644
@@ -2,6 +2,11 @@
 #ifndef __ASM_GENERIC_UCONTEXT_H
 #define __ASM_GENERIC_UCONTEXT_H
 
+#ifndef __KERNEL__
+#include <asm-generic/signal.h>
+#include <asm/sigcontext.h>
+#endif
+
 struct ucontext {
        unsigned long     uc_flags;
        struct ucontext  *uc_link;
include/uapi/linux/agpgart.h +0 -1
index f5251045181a..4e828cf487bc 100644
@@ -52,7 +52,6 @@
 
 #ifndef __KERNEL__
 #include <linux/types.h>
-#include <stdlib.h>
 
 struct agp_version {
        __u16 major;
include/uapi/linux/android/binder.h +1 -0
index bfaec6903b8b..fd6de2203057 100644
@@ -23,6 +23,7 @@
 
 #include <linux/types.h>
 #include <linux/ioctl.h>
+#include <sys/types.h>
 
 #define B_PACK_CHARS(c1, c2, c3, c4) \
        ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
include/uapi/linux/chio.h +6 -0
index 689fc93fafda..5e63753a0d53 100644
@@ -3,6 +3,11 @@
  * ioctl interface for the scsi media changer driver
  */
 
+#ifndef _UAPI_CHIO_H
+#define _UAPI_CHIO_H
+
+#include <linux/compiler.h>
+
 /* changer element types */
 #define CHET_MT   0    /* media transport element (robot) */
 #define CHET_ST   1    /* storage element (media slots) */
@@ -167,3 +172,4 @@ struct changer_set_voltag {
  * c-basic-offset: 8
  * End:
  */
+#endif
include/uapi/linux/coda_psdev.h +1 -0
index aa6623efd2dd..31b1867021b7 100644
@@ -3,6 +3,7 @@
 #define _UAPI__CODA_PSDEV_H
 
 #include <linux/magic.h>
+#include <sys/types.h>
 
 #define CODA_PSDEV_MAJOR 67
 #define MAX_CODADEVS  5           /* how many do we allow */
include/uapi/linux/dvb/dmx.h +0 -3
index b4112f0b6dd3..ce30e9f6145a 100644
@@ -26,9 +26,6 @@
 #define _UAPI_DVBDMX_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <time.h>
-#endif
 
 
 #define DMX_FILTER_SIZE 16
include/uapi/linux/dvb/video.h +0 -3
index df3d7028c807..8f3a485b9988 100644
@@ -26,9 +26,6 @@
 #define _UAPI_DVBVIDEO_H_
 
 #include <linux/types.h>
-#ifndef __KERNEL__
-#include <time.h>
-#endif
 
 typedef enum {
        VIDEO_FORMAT_4_3,     /* Select 4:3 format */
include/uapi/linux/errqueue.h +1 -0
index dc64cfaf13da..ad2421e3d613 100644
@@ -2,6 +2,7 @@
 #ifndef _UAPI_LINUX_ERRQUEUE_H
 #define _UAPI_LINUX_ERRQUEUE_H
 
+#include <linux/time.h>
 #include <linux/types.h>
 
 struct sock_extended_err {
include/uapi/linux/kexec.h +1 -0
index 6d112868272d..49d50d469723 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/types.h>
+#include <stddef.h>
 
 /* kexec flags for different usage scenarios */
 #define KEXEC_ON_CRASH         0x00000001
include/uapi/linux/kfd_ioctl.h +1 -0
index b4f5073dbac2..4a882a133b69 100644
@@ -25,6 +25,7 @@
 
 #include <drm/drm.h>
 #include <linux/ioctl.h>
+#include <stdint.h>
 
 #define KFD_IOCTL_MAJOR_VERSION 1
 #define KFD_IOCTL_MINOR_VERSION 1
include/uapi/linux/lightnvm.h +0 -1
index f9a1be7fc696..af28d32b0ac3 100644
@@ -24,7 +24,6 @@
 #include <linux/kernel.h>
 #include <linux/ioctl.h>
 #else /* __KERNEL__ */
-#include <stdio.h>
 #include <sys/ioctl.h>
 #define DISK_NAME_LEN 32
 #endif /* __KERNEL__ */
include/uapi/linux/ndctl.h +1 -0
index 7e27070b9440..a89a294e5ca5 100644
@@ -13,6 +13,7 @@
 #ifndef __NDCTL_H__
 #define __NDCTL_H__
 
+#include <linux/compiler.h>
 #include <linux/types.h>
 
 struct nd_cmd_dimm_flags {
include/uapi/linux/netfilter_bridge/ebtables.h +1 -0
index 0c7dc8315013..c57850b90b50 100644
@@ -16,6 +16,7 @@
 #include <linux/types.h>
 #include <linux/if.h>
 #include <linux/netfilter_bridge.h>
+#include <stdint.h>
 
 #define EBT_TABLE_MAXNAMELEN 32
 #define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
include/uapi/linux/nfs4_mount.h +3 -0
index d20bb869bb99..6c9792073b19 100644
@@ -19,6 +19,9 @@
  */
 #define NFS4_MOUNT_VERSION     1
 
+#include <linux/socket.h> /* for struct sockaddr. */
+#include <linux/compiler.h>
+
 struct nfs_string {
        unsigned int len;
        const char __user * data;
include/uapi/linux/psp-sev.h +1 -0
index 9008f31c7eb6..c796f1b194a3 100644
@@ -18,6 +18,7 @@
 #define __PSP_SEV_USER_H__
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /**
  * SEV platform commands
include/uapi/linux/scc.h +1 -1
index c5bc7f747755..9122d48a4227 100644
@@ -4,7 +4,7 @@
 #ifndef _UAPI_SCC_H
 #define _UAPI_SCC_H
 
-
+#include <linux/sockios.h>
 /* selection of hardware types */
 
 #define PA0HZP         0x00    /* hardware type for PA0HZP SCC card and compatible */
include/uapi/linux/sctp.h +3 -0
index b64d583bf053..de4675d92e9f 100644
@@ -56,6 +56,9 @@
 
 #include <linux/types.h>
 #include <linux/socket.h>
+#ifndef __KERNEL__
+#include <stdint.h>
+#endif
 
 typedef __s32 sctp_assoc_t;
 
include/uapi/linux/sdla.h +2 -0
index 1e3735be6511..2a0dc687aa49 100644
@@ -24,6 +24,8 @@
 #ifndef _UAPISDLA_H
 #define _UAPISDLA_H
 
+#include <linux/compiler.h>
+
 /* adapter type */
 #define SDLA_TYPES
 #define SDLA_S502A                     5020
include/uapi/linux/socket.h +4 -0
index 8eb96021709c..51c11f6b26e6 100644
@@ -11,6 +11,10 @@
 
 typedef unsigned short __kernel_sa_family_t;
 
+#ifndef __KERNEL__
+#include <sys/socket.h>                        /* for struct sockaddr.         */
+#endif
+
 struct __kernel_sockaddr_storage {
        __kernel_sa_family_t    ss_family;              /* address family */
        /* Following field(s) are implementation specific */
include/uapi/linux/stddef.h +5 -0
index ee8220f8dcf5..c949a6836417 100644
@@ -1,6 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __UAPI_STDDEF_H__
+#define __UAPI_STDDEF_H__
+
 #include <linux/compiler_types.h>
 
 #ifndef __always_inline
 #define __always_inline inline
 #endif
+
+#endif // __UAPI_STDDEF_H__
include/uapi/linux/sysctl.h +1 -0
index 6b58371b1f0d..fac6c1c7def2 100644
@@ -26,6 +26,7 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <stddef.h>
 
 #define CTL_MAXNAME 10         /* how many path components do we allow in a
                                   call to sysctl?   In other words, what is
include/uapi/linux/types.h +1 -0
index cd4f0b897a48..d61eb82432be 100644
@@ -11,6 +11,7 @@
 #endif /* __EXPORTED_HEADERS__ */
 #endif
 
+#include <linux/compiler_types.h>
 #include <linux/posix_types.h>
 
 
include/uapi/linux/vbox_vmmdev_types.h +1 -0
index 0e68024f36c7..26d0e69f6fdc 100644
@@ -11,6 +11,7 @@
 
 #include <asm/bitsperlong.h>
 #include <linux/types.h>
+#include <linux/compiler.h>
 
 /*
  * We cannot use linux' compiletime_assert here because it expects to be used
include/uapi/linux/vboxguest.h +1 -0
index 612f0c7d3558..44606c96f830 100644
@@ -9,6 +9,7 @@
 #define __UAPI_VBOXGUEST_H__
 
 #include <asm/bitsperlong.h>
+#include <linux/compiler.h>
 #include <linux/ioctl.h>
 #include <linux/vbox_err.h>
 #include <linux/vbox_vmmdev_types.h>
include/uapi/rdma/hfi/hfi1_user.h +1 -0
index c6a984c0c881..6f5e461b8015 100644
@@ -58,6 +58,7 @@
 #define _LINUX__HFI1_USER_H
 
 #include <linux/types.h>
+#include <linux/compiler.h>
 #include <rdma/rdma_user_ioctl.h>
 
 /*
include/uapi/scsi/scsi_bsg_fc.h +2 -0
index 62597d86beed..23971d00c46d 100644
@@ -23,6 +23,8 @@
 #ifndef SCSI_BSG_FC_H
 #define SCSI_BSG_FC_H
 
+#include <stdint.h>
+
 /*
  * This file intended to be included by both kernel and user space
  */
include/uapi/scsi/scsi_netlink.h +1 -0
index 5ccc2333acab..37d39eb671cc 100644
@@ -25,6 +25,7 @@
 
 #include <linux/netlink.h>
 #include <linux/types.h>
+#include <stdint.h>
 
 /*
  * This file intended to be included by both kernel and user space
include/uapi/sound/asound.h +1 -2
index ed0a120d4f08..b569f0eb3a7f 100644
@@ -31,7 +31,7 @@
 #endif
 
 #ifndef __KERNEL__
-#include <stdlib.h>
+#include<linux/time.h>
 #endif
 
 /*
--

2.17.1.1185.g55be947832-goog

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Jayant Chowdhary
Thank you for the patch! Yet something to improve:

Hi Jayant,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17 next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jayant-Chowdhary/uapi-Make-generic-uapi-headers-compile-standalone/20180608-014548
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

In file included from include/linux/coda_psdev.h:7:0,

                    from fs/coda/cache.c:24:
>> include/uapi/linux/coda_psdev.h:6:10: fatal error: sys/types.h: No such file or directory
    #include <sys/types.h>
             ^~~~~~~~~~~~~

compilation terminated.

vim +6 include/uapi/linux/coda_psdev.h

     4	
     5	#include <linux/magic.h>
   > 6	#include <sys/types.h>
     7	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw
In reply to Jayant Chowdhary
Thank you for the patch! Yet something to improve:

Hi Jayant,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.17 next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jayant-Chowdhary/uapi-Make-generic-uapi-headers-compile-standalone/20180608-014548
config: i386-randconfig-a0-201822 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce:

        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

In file included from drivers//android/binder.c:79:0:

>> include/uapi/linux/android/binder.h:26:23: fatal error: sys/types.h: No such file or directory
    #include <sys/types.h>
                          ^

compilation terminated.

vim +26 include/uapi/linux/android/binder.h

    23	
    24	#include <linux/types.h>
    25	#include <linux/ioctl.h>
  > 26	#include <sys/types.h>
    27	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#5 lore raw
In reply to Jayant Chowdhary
Thank you for the patch! Perhaps something to improve:

Hi Jayant,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17 next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jayant-Chowdhary/uapi-Make-generic-uapi-headers-compile-standalone/20180608-014548
reproduce:

        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

drivers/gpu/drm/radeon/cik.c:6721:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6721:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6721:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6722:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6722:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6722:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6724:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6724:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6724:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6725:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6725:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6725:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6726:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6726:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6726:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6731:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6731:49: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6731:49: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6733:49: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6733:49: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6733:49: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6735:57: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6735:57: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6735:57: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6742:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6742:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6742:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6743:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6743:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6743:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6746:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6746:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6746:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6747:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6747:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6747:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6750:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6750:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6750:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6751:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6751:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6751:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6755:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6755:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6755:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6756:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6756:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6756:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6759:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6759:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6759:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6760:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6760:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6760:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6763:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6763:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6763:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6764:33: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6764:33: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6764:33: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6768:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6768:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6768:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6769:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6769:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6769:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6771:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6771:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6771:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6772:25: sparse: incorrect type in assignment (different base types) @@ expected unsigned int volatile [unsigned] [usertype] <noident> @@ got latile [unsigned] [usertype] <noident> @@
drivers/gpu/drm/radeon/cik.c:6772:25: expected unsigned int volatile [unsigned] [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:6772:25: got restricted __le32 [usertype] <noident>
drivers/gpu/drm/radeon/cik.c:7497:24: sparse: cast to restricted __le32 drivers/gpu/drm/radeon/cik.c:7587:27: sparse: cast to restricted __le32 drivers/gpu/drm/radeon/cik.c:7588:28: sparse: cast to restricted __le32 drivers/gpu/drm/radeon/cik.c:7589:27: sparse: cast to restricted __le32 drivers/gpu/drm/radeon/cik.c:7497:24: sparse: cast to restricted __le32 drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9065:16: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9142:15: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9142:15: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9144:22: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9144:22: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9262:29: sparse: expression using sizeof(void) drivers/gpu/drm/radeon/cik.c:9293:39: sparse: expression using sizeof(void)

>> drivers/gpu/drm/radeon/cik.c:9333:39: sparse: too many warnings

vim +9333 drivers/gpu/drm/radeon/cik.c

cd84a27d Alex Deucher  2012-07-20  9234  
cd84a27d Alex Deucher  2012-07-20  9235  /**
cd84a27d Alex Deucher  2012-07-20  9236   * dce8_program_watermarks - program display watermarks
cd84a27d Alex Deucher  2012-07-20  9237   *
cd84a27d Alex Deucher  2012-07-20  9238   * @rdev: radeon_device pointer
cd84a27d Alex Deucher  2012-07-20  9239   * @radeon_crtc: the selected display controller
cd84a27d Alex Deucher  2012-07-20  9240   * @lb_size: line buffer size
cd84a27d Alex Deucher  2012-07-20  9241   * @num_heads: number of display controllers in use
cd84a27d Alex Deucher  2012-07-20  9242   *
cd84a27d Alex Deucher  2012-07-20  9243   * Calculate and program the display watermarks for the
cd84a27d Alex Deucher  2012-07-20  9244   * selected display controller (CIK).
cd84a27d Alex Deucher  2012-07-20  9245   */
cd84a27d Alex Deucher  2012-07-20  9246  static void dce8_program_watermarks(struct radeon_device *rdev,
cd84a27d Alex Deucher  2012-07-20  9247  				    struct radeon_crtc *radeon_crtc,
cd84a27d Alex Deucher  2012-07-20  9248  				    u32 lb_size, u32 num_heads)
cd84a27d Alex Deucher  2012-07-20  9249  {
cd84a27d Alex Deucher  2012-07-20  9250  	struct drm_display_mode *mode = &radeon_crtc->base.mode;
58ea2dea Alex Deucher  2013-01-24  9251  	struct dce8_wm_params wm_low, wm_high;
e6b9a6c8 Mario Kleiner 2017-04-24  9252  	u32 active_time;
cd84a27d Alex Deucher  2012-07-20  9253  	u32 line_time = 0;
cd84a27d Alex Deucher  2012-07-20  9254  	u32 latency_watermark_a = 0, latency_watermark_b = 0;
cd84a27d Alex Deucher  2012-07-20  9255  	u32 tmp, wm_mask;
cd84a27d Alex Deucher  2012-07-20  9256  
cd84a27d Alex Deucher  2012-07-20  9257  	if (radeon_crtc->base.enabled && num_heads && mode) {
55f61a04 Mario Kleiner 2017-06-13  9258  		active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
55f61a04 Mario Kleiner 2017-06-13  9259  					    (u32)mode->clock);
55f61a04 Mario Kleiner 2017-06-13  9260  		line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
55f61a04 Mario Kleiner 2017-06-13  9261  					  (u32)mode->clock);
55f61a04 Mario Kleiner 2017-06-13  9262  		line_time = min(line_time, (u32)65535);
cd84a27d Alex Deucher  2012-07-20  9263  
58ea2dea Alex Deucher  2013-01-24  9264  		/* watermark for high clocks */
58ea2dea Alex Deucher  2013-01-24  9265  		if ((rdev->pm.pm_method == PM_METHOD_DPM) &&
58ea2dea Alex Deucher  2013-01-24  9266  		    rdev->pm.dpm_enabled) {
58ea2dea Alex Deucher  2013-01-24  9267  			wm_high.yclk =
58ea2dea Alex Deucher  2013-01-24  9268  				radeon_dpm_get_mclk(rdev, false) * 10;
58ea2dea Alex Deucher  2013-01-24  9269  			wm_high.sclk =
58ea2dea Alex Deucher  2013-01-24  9270  				radeon_dpm_get_sclk(rdev, false) * 10;
58ea2dea Alex Deucher  2013-01-24  9271  		} else {
58ea2dea Alex Deucher  2013-01-24  9272  			wm_high.yclk = rdev->pm.current_mclk * 10;
58ea2dea Alex Deucher  2013-01-24  9273  			wm_high.sclk = rdev->pm.current_sclk * 10;
58ea2dea Alex Deucher  2013-01-24  9274  		}
58ea2dea Alex Deucher  2013-01-24  9275  
58ea2dea Alex Deucher  2013-01-24  9276  		wm_high.disp_clk = mode->clock;
58ea2dea Alex Deucher  2013-01-24  9277  		wm_high.src_width = mode->crtc_hdisplay;
e6b9a6c8 Mario Kleiner 2017-04-24  9278  		wm_high.active_time = active_time;
58ea2dea Alex Deucher  2013-01-24  9279  		wm_high.blank_time = line_time - wm_high.active_time;
58ea2dea Alex Deucher  2013-01-24  9280  		wm_high.interlaced = false;
cd84a27d Alex Deucher  2012-07-20  9281  		if (mode->flags & DRM_MODE_FLAG_INTERLACE)
58ea2dea Alex Deucher  2013-01-24  9282  			wm_high.interlaced = true;
58ea2dea Alex Deucher  2013-01-24  9283  		wm_high.vsc = radeon_crtc->vsc;
58ea2dea Alex Deucher  2013-01-24  9284  		wm_high.vtaps = 1;
cd84a27d Alex Deucher  2012-07-20  9285  		if (radeon_crtc->rmx_type != RMX_OFF)
58ea2dea Alex Deucher  2013-01-24  9286  			wm_high.vtaps = 2;
58ea2dea Alex Deucher  2013-01-24  9287  		wm_high.bytes_per_pixel = 4; /* XXX: get this from fb config */
58ea2dea Alex Deucher  2013-01-24  9288  		wm_high.lb_size = lb_size;
58ea2dea Alex Deucher  2013-01-24  9289  		wm_high.dram_channels = cik_get_number_of_dram_channels(rdev);
58ea2dea Alex Deucher  2013-01-24  9290  		wm_high.num_heads = num_heads;
cd84a27d Alex Deucher  2012-07-20  9291  
cd84a27d Alex Deucher  2012-07-20  9292  		/* set for high clocks */
58ea2dea Alex Deucher  2013-01-24  9293  		latency_watermark_a = min(dce8_latency_watermark(&wm_high), (u32)65535);
58ea2dea Alex Deucher  2013-01-24  9294  
58ea2dea Alex Deucher  2013-01-24  9295  		/* possibly force display priority to high */
58ea2dea Alex Deucher  2013-01-24  9296  		/* should really do this at mode validation time... */
58ea2dea Alex Deucher  2013-01-24  9297  		if (!dce8_average_bandwidth_vs_dram_bandwidth_for_display(&wm_high) ||
58ea2dea Alex Deucher  2013-01-24  9298  		    !dce8_average_bandwidth_vs_available_bandwidth(&wm_high) ||
58ea2dea Alex Deucher  2013-01-24  9299  		    !dce8_check_latency_hiding(&wm_high) ||
58ea2dea Alex Deucher  2013-01-24  9300  		    (rdev->disp_priority == 2)) {
58ea2dea Alex Deucher  2013-01-24  9301  			DRM_DEBUG_KMS("force priority to high\n");
58ea2dea Alex Deucher  2013-01-24  9302  		}
58ea2dea Alex Deucher  2013-01-24  9303  
58ea2dea Alex Deucher  2013-01-24  9304  		/* watermark for low clocks */
58ea2dea Alex Deucher  2013-01-24  9305  		if ((rdev->pm.pm_method == PM_METHOD_DPM) &&
58ea2dea Alex Deucher  2013-01-24  9306  		    rdev->pm.dpm_enabled) {
58ea2dea Alex Deucher  2013-01-24  9307  			wm_low.yclk =
58ea2dea Alex Deucher  2013-01-24  9308  				radeon_dpm_get_mclk(rdev, true) * 10;
58ea2dea Alex Deucher  2013-01-24  9309  			wm_low.sclk =
58ea2dea Alex Deucher  2013-01-24  9310  				radeon_dpm_get_sclk(rdev, true) * 10;
58ea2dea Alex Deucher  2013-01-24  9311  		} else {
58ea2dea Alex Deucher  2013-01-24  9312  			wm_low.yclk = rdev->pm.current_mclk * 10;
58ea2dea Alex Deucher  2013-01-24  9313  			wm_low.sclk = rdev->pm.current_sclk * 10;
58ea2dea Alex Deucher  2013-01-24  9314  		}
58ea2dea Alex Deucher  2013-01-24  9315  
58ea2dea Alex Deucher  2013-01-24  9316  		wm_low.disp_clk = mode->clock;
58ea2dea Alex Deucher  2013-01-24  9317  		wm_low.src_width = mode->crtc_hdisplay;
e6b9a6c8 Mario Kleiner 2017-04-24  9318  		wm_low.active_time = active_time;
58ea2dea Alex Deucher  2013-01-24  9319  		wm_low.blank_time = line_time - wm_low.active_time;
58ea2dea Alex Deucher  2013-01-24  9320  		wm_low.interlaced = false;
58ea2dea Alex Deucher  2013-01-24  9321  		if (mode->flags & DRM_MODE_FLAG_INTERLACE)
58ea2dea Alex Deucher  2013-01-24  9322  			wm_low.interlaced = true;
58ea2dea Alex Deucher  2013-01-24  9323  		wm_low.vsc = radeon_crtc->vsc;
58ea2dea Alex Deucher  2013-01-24  9324  		wm_low.vtaps = 1;
58ea2dea Alex Deucher  2013-01-24  9325  		if (radeon_crtc->rmx_type != RMX_OFF)
58ea2dea Alex Deucher  2013-01-24  9326  			wm_low.vtaps = 2;
58ea2dea Alex Deucher  2013-01-24  9327  		wm_low.bytes_per_pixel = 4; /* XXX: get this from fb config */
58ea2dea Alex Deucher  2013-01-24  9328  		wm_low.lb_size = lb_size;
58ea2dea Alex Deucher  2013-01-24  9329  		wm_low.dram_channels = cik_get_number_of_dram_channels(rdev);
58ea2dea Alex Deucher  2013-01-24  9330  		wm_low.num_heads = num_heads;
58ea2dea Alex Deucher  2013-01-24  9331  
cd84a27d Alex Deucher  2012-07-20  9332  		/* set for low clocks */
58ea2dea Alex Deucher  2013-01-24 @9333  		latency_watermark_b = min(dce8_latency_watermark(&wm_low), (u32)65535);
cd84a27d Alex Deucher  2012-07-20  9334  
cd84a27d Alex Deucher  2012-07-20  9335  		/* possibly force display priority to high */
cd84a27d Alex Deucher  2012-07-20  9336  		/* should really do this at mode validation time... */
58ea2dea Alex Deucher  2013-01-24  9337  		if (!dce8_average_bandwidth_vs_dram_bandwidth_for_display(&wm_low) ||
58ea2dea Alex Deucher  2013-01-24  9338  		    !dce8_average_bandwidth_vs_available_bandwidth(&wm_low) ||
58ea2dea Alex Deucher  2013-01-24  9339  		    !dce8_check_latency_hiding(&wm_low) ||
cd84a27d Alex Deucher  2012-07-20  9340  		    (rdev->disp_priority == 2)) {
cd84a27d Alex Deucher  2012-07-20  9341  			DRM_DEBUG_KMS("force priority to high\n");
cd84a27d Alex Deucher  2012-07-20  9342  		}
5b5561b3 Mario Kleiner 2015-11-25  9343  
5b5561b3 Mario Kleiner 2015-11-25  9344  		/* Save number of lines the linebuffer leads before the scanout */
5b5561b3 Mario Kleiner 2015-11-25  9345  		radeon_crtc->lb_vblank_lead_lines = DIV_ROUND_UP(lb_size, mode->crtc_hdisplay);
cd84a27d Alex Deucher  2012-07-20  9346  	}
cd84a27d Alex Deucher  2012-07-20  9347  
cd84a27d Alex Deucher  2012-07-20  9348  	/* select wm A */
cd84a27d Alex Deucher  2012-07-20  9349  	wm_mask = RREG32(DPG_WATERMARK_MASK_CONTROL + radeon_crtc->crtc_offset);
cd84a27d Alex Deucher  2012-07-20  9350  	tmp = wm_mask;
cd84a27d Alex Deucher  2012-07-20  9351  	tmp &= ~LATENCY_WATERMARK_MASK(3);
cd84a27d Alex Deucher  2012-07-20  9352  	tmp |= LATENCY_WATERMARK_MASK(1);
cd84a27d Alex Deucher  2012-07-20  9353  	WREG32(DPG_WATERMARK_MASK_CONTROL + radeon_crtc->crtc_offset, tmp);
cd84a27d Alex Deucher  2012-07-20  9354  	WREG32(DPG_PIPE_LATENCY_CONTROL + radeon_crtc->crtc_offset,
cd84a27d Alex Deucher  2012-07-20  9355  	       (LATENCY_LOW_WATERMARK(latency_watermark_a) |
cd84a27d Alex Deucher  2012-07-20  9356  		LATENCY_HIGH_WATERMARK(line_time)));
cd84a27d Alex Deucher  2012-07-20  9357  	/* select wm B */
cd84a27d Alex Deucher  2012-07-20  9358  	tmp = RREG32(DPG_WATERMARK_MASK_CONTROL + radeon_crtc->crtc_offset);
cd84a27d Alex Deucher  2012-07-20  9359  	tmp &= ~LATENCY_WATERMARK_MASK(3);
cd84a27d Alex Deucher  2012-07-20  9360  	tmp |= LATENCY_WATERMARK_MASK(2);
cd84a27d Alex Deucher  2012-07-20  9361  	WREG32(DPG_WATERMARK_MASK_CONTROL + radeon_crtc->crtc_offset, tmp);
cd84a27d Alex Deucher  2012-07-20  9362  	WREG32(DPG_PIPE_LATENCY_CONTROL + radeon_crtc->crtc_offset,
cd84a27d Alex Deucher  2012-07-20  9363  	       (LATENCY_LOW_WATERMARK(latency_watermark_b) |
cd84a27d Alex Deucher  2012-07-20  9364  		LATENCY_HIGH_WATERMARK(line_time)));
cd84a27d Alex Deucher  2012-07-20  9365  	/* restore original selection */
cd84a27d Alex Deucher  2012-07-20  9366  	WREG32(DPG_WATERMARK_MASK_CONTROL + radeon_crtc->crtc_offset, wm_mask);
58ea2dea Alex Deucher  2013-01-24  9367  
58ea2dea Alex Deucher  2013-01-24  9368  	/* save values for DPM */
58ea2dea Alex Deucher  2013-01-24  9369  	radeon_crtc->line_time = line_time;
58ea2dea Alex Deucher  2013-01-24  9370  	radeon_crtc->wm_high = latency_watermark_a;
58ea2dea Alex Deucher  2013-01-24  9371  	radeon_crtc->wm_low = latency_watermark_b;
cd84a27d Alex Deucher  2012-07-20  9372  }
cd84a27d Alex Deucher  2012-07-20  9373  

:::::: The code at line 9333 was first introduced by commit
:::::: 58ea2deab36ecf0b416d3486442cc6df693dcc79 drm/radeon/kms: fix up dce8 display watermark calc for dpm

:::::: TO: Alex Deucher <[email protected]> :::::: CC: Alex Deucher <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw
In reply to Jayant Chowdhary
Quoted 4 lines · Jayant Chowdhary

In order for static analysis tools to analyze each of the uapi headers, we need to enable them to compile stand-alone. Some uapi headers were missing dependencies which would not make them compile stand-alone in user-land. This patch adds those dependencies.

Hi,

Thanks for getting started on this. I see that the kbuild robot and I were still not able to do successful builds even after this patch is applied. We were building different targets though. robot was doing kernel builds and I was doing a large "all-uapi" build.

I started on my all-uapi work about 1 week ago but haven't posted anything yet, but it's posted (attached) below. It's not yet up to kernel quality yet (for a Makefile), and I have made very little progress toward a successful userspace build.

If anyone is interested, just put these 3 files in <kernel_tree>/tools/build and then run:

make ARCH=$some_arch O=build_dir headers_check
so that the headers will be cleaned up and installed in build_dir/usr/.

Then run 'make -f all-uapi.mk'
and the userspace program with all header files found in build_dir/usr/include will be built -- i.e., attempted (not successfully).

(note: chmod +x hdr-fix-lines.pl)

Signature · 1 line
~Randy
# all-uapi.mk
# currently resides in tools/build/
#
# before running 'make -f all-uapi.mk',
# run (from top of kernel tree): make ARCH=arch O=dir headers_check
# so that the uapi headers will be installed.

srctree=../..
CC=gcc

all: all-uapi.h all-uapi.o

all-uapi.h: all-uapi.mk hdr-fix-lines.pl
rm -f all-uapi.h
touch all-uapi.h
# find $(srctree)/xx64/usr/include/uapi -type f | grep -v \\.orig |

	find $(srctree)/xx64/usr/include -type f | grep -v \\.orig | \
		./hdr-fix-lines.pl >>all-uapi.h

all-uapi.o: all-uapi.h

	$(CC) -I../../xx64/usr/include all-uapi.c -o all-uapi.o

// SPDX GPL 2.0
// This userspace source file pulls in all #include <uapi/*> header files // to see what kinds of problems happen.

#include <stdio.h>
#include <stdarg.h>
#include <stdint.h>

#include <linux/posix_types.h>
#include <asm-generic/ipcbuf.h>

#include "all-uapi.h"

int main(int argc, char *argv[])
{
}

#7 lore raw

Hi Randy,

Quoted 20 lines · Randy Dunlap
Quoted 4 lines · Jayant Chowdhary

In order for static analysis tools to analyze each of the uapi headers, we need to enable them to compile stand-alone. Some uapi headers were missing dependencies which would not make them compile stand-alone in user-land. This patch adds those dependencies.

Hi,

Thanks for getting started on this. I see that the kbuild robot and I were still not able to do successful builds even after this patch is applied. We were building different targets though. robot was doing kernel builds and I was doing a large "all-uapi" build.

I started on my all-uapi work about 1 week ago but haven't posted anything yet, but it's posted (attached) below. It's not yet up to kernel quality yet (for a Makefile), and I have made very little progress toward a successful userspace build.

If anyone is interested, just put these 3 files in <kernel_tree>/tools/build and then run:

Quoted 10 lines

make ARCH=$some_arch O=build_dir headers_check
so that the headers will be cleaned up and installed in build_dir/usr/.

Then run 'make -f all-uapi.mk'
and the userspace program with all header files found in build_dir/usr/include will be built -- i.e., attempted (not successfully).

(note: chmod +x hdr-fix-lines.pl)

Thank you for this. This is surely a more formal way of finding out and verifying problems w.r.t the uapi headers, being compiled from user-land. I do have one concern with this approach though: the make target 'all-uapi.o' depends on all-uapi.h, which includes all the uapi headers installed in <build-dir>. So this does make sure that when all the uapi headers are included, a user-land program will be able to compile fine, without adding any additional dependencies. However, this could be masking some cases of dependency exclusion. An example can be seen as follows:

Header dependency chain:
A.h->B.h, however A.h doesn't actually include B.h C.h->B.h, C.h does include B.h

all-uapi.h
#include<C.h>
#include<A.h>

all-uapi.h will compile fine, since the inclusion of C.h before A.h satisfies A.h's dependency on B.h. However, if a user-land program includes just A.h, it will not compile without adding B.h. So the target being built successfully masked an issue with the uapi header, no?

I guess it might be better to just have a Makefile which produces a target for each header in the set produced by 'make headers_install' and compile those, with a -I flag as <build-dir>/usr/include ?

Also, do you think it might be better to do this work in phases ? I'm guessing we'll be seeing many headers to fix (especially arch specific ones). Fixing these separately: first the generic ones, followed by the ones for the arches, might be easier ?

Thanks,
Jayant

#8 lore raw
Quoted 47 lines · Jayant Chowdhary

Hi Randy,

Quoted 20 lines · Randy Dunlap
Quoted 4 lines · Jayant Chowdhary

In order for static analysis tools to analyze each of the uapi headers, we need to enable them to compile stand-alone. Some uapi headers were missing dependencies which would not make them compile stand-alone in user-land. This patch adds those dependencies.

Hi,

Thanks for getting started on this. I see that the kbuild robot and I were still not able to do successful builds even after this patch is applied. We were building different targets though. robot was doing kernel builds and I was doing a large "all-uapi" build.

I started on my all-uapi work about 1 week ago but haven't posted anything yet, but it's posted (attached) below. It's not yet up to kernel quality yet (for a Makefile), and I have made very little progress toward a successful userspace build.

If anyone is interested, just put these 3 files in <kernel_tree>/tools/build and then run:

Quoted 10 lines

make ARCH=$some_arch O=build_dir headers_check
so that the headers will be cleaned up and installed in build_dir/usr/.

Then run 'make -f all-uapi.mk'
and the userspace program with all header files found in build_dir/usr/include will be built -- i.e., attempted (not successfully).

(note: chmod +x hdr-fix-lines.pl)

Thank you for this. This is surely a more formal way of finding out and verifying problems w.r.t the uapi headers, being compiled from user-land. I do have one concern with this approach though: the make target 'all-uapi.o' depends on all-uapi.h, which includes all the uapi headers installed in <build-dir>. So this does make sure that when all the uapi headers are included, a user-land program will be able to compile fine, without adding any additional dependencies. However, this could be masking some cases of dependency exclusion. An example can be seen as follows:

Header dependency chain:
A.h->B.h, however A.h doesn't actually include B.h C.h->B.h, C.h does include B.h

Quoted 8 lines

all-uapi.h
#include<C.h>
#include<A.h>

all-uapi.h will compile fine, since the inclusion of C.h before A.h satisfies A.h's dependency on B.h. However, if a user-land program includes just A.h, it will not compile without adding B.h. So the target being built successfully masked an issue with the uapi header, no?

Yes, good point.

Quoted 3 lines

I guess it might be better to just have a Makefile which produces a target for each header in the set produced by 'make headers_install' and compile those, with a -I flag as <build-dir>/usr/include ?

Yes, that makes sense. Should be fairly straightforward to do that.

Quoted 4 lines

Also, do you think it might be better to do this work in phases ? I'm guessing we'll be seeing many headers to fix (especially arch specific ones). Fixing these separately: first the generic ones, followed by the ones for the arches, might be easier ?

Absolutely. I was planning to just focus on one sub-directory of usr/include/choose_one (and begin with a smaller one).

thanks,

Signature · 1 line
~Randy
#9 lore raw
In reply to Jayant Chowdhary
Thank you for the patch! Perhaps something to improve:

Hi Jayant,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.17 next-20180607]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jayant-Chowdhary/uapi-Make-generic-uapi-headers-compile-standalone/20180608-014548
reproduce:

        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:417:9: sparse: preprocessor token offsetof redefined include/linux/stddef.h:17:9: this was the original definition

>> drivers/hv/hv_fcopy.c:160:34: sparse: incorrect type in argument 1 (different type sizes) @@    expected unsigned short const [usertype] *pwcs @@    got nst [usertype] *pwcs @@

drivers/hv/hv_fcopy.c:160:34: expected unsigned short const [usertype] *pwcs
drivers/hv/hv_fcopy.c:160:34: got int [usertype] *<noident>
drivers/hv/hv_fcopy.c:164:34: sparse: incorrect type in argument 1 (different type sizes) @@ expected unsigned short const [usertype] *pwcs @@ got nst [usertype] *pwcs @@
drivers/hv/hv_fcopy.c:164:34: expected unsigned short const [usertype] *pwcs
drivers/hv/hv_fcopy.c:164:34: got int [usertype] *<noident>
--
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:417:9: sparse: preprocessor token offsetof redefined include/linux/stddef.h:17:9: this was the original definition drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:194:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:227:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:277:37: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:346:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:350:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:379:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:435:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:471:48: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:492:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:526:41: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:665:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:713:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:761:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:761:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:761:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:761:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:761:18: sparse: expression using sizeof(void) drivers/hwmon/asc7621.c:761:18: sparse: expression using sizeof(void)

>> drivers/hwmon/asc7621.c:761:18: sparse: too many warnings
--
   /usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:417:9: sparse: preprocessor token offsetof redefined
   include/linux/stddef.h:17:9: this was the original definition
>> fs/hfs/trans.c:52:73: sparse: incorrect type in argument 3 (different type sizes) @@    expected unsigned short [usertype] *uni @@    got pe] *uni @@

fs/hfs/trans.c:52:73: expected unsigned short [usertype] *uni
fs/hfs/trans.c:52:73: got int *<noident>
fs/hfs/trans.c:113:63: sparse: incorrect type in argument 3 (different type sizes) @@ expected unsigned short [usertype] *uni @@ got pe] *uni @@
fs/hfs/trans.c:113:63: expected unsigned short [usertype] *uni
fs/hfs/trans.c:113:63: got int *<noident>
--
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:417:9: sparse: preprocessor token offsetof redefined include/linux/stddef.h:17:9: this was the original definition fs/hfsplus/unicode.c:77:20: sparse: expression using sizeof(void) fs/hfsplus/unicode.c:77:20: sparse: expression using sizeof(void)

>> fs/hfsplus/unicode.c:259:61: sparse: incorrect type in argument 3 (different type sizes) @@    expected unsigned short [usertype] *uni @@    got ort [usertype] *uni @@
   fs/hfsplus/unicode.c:259:61:    expected unsigned short [usertype] *uni
   fs/hfsplus/unicode.c:259:61:    got int [usertype] *uc
>> fs/hfsplus/unicode.c:259:61: sparse: incorrect type in argument 3 (different type sizes) @@    expected unsigned short [usertype] *uni @@    got ort [usertype] *uni @@
   fs/hfsplus/unicode.c:259:61:    expected unsigned short [usertype] *uni
   fs/hfsplus/unicode.c:259:61:    got int [usertype] *uc
>> fs/hfsplus/unicode.c:259:61: sparse: incorrect type in argument 3 (different type sizes) @@    expected unsigned short [usertype] *uni @@    got ort [usertype] *uni @@
   fs/hfsplus/unicode.c:259:61:    expected unsigned short [usertype] *uni
   fs/hfsplus/unicode.c:259:61:    got int [usertype] *uc
>> fs/hfsplus/unicode.c:259:61: sparse: incorrect type in argument 3 (different type sizes) @@    expected unsigned short [usertype] *uni @@    got ort [usertype] *uni @@

fs/hfsplus/unicode.c:259:61: expected unsigned short [usertype] *uni
fs/hfsplus/unicode.c:259:61: got int [usertype] *uc
--
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h:417:9: sparse: preprocessor token offsetof redefined include/linux/stddef.h:17:9: this was the original definition

>> fs/isofs/joliet.c:52:40: sparse: incorrect type in argument 1 (different type sizes) @@    expected unsigned short const [usertype] *pwcs @@    got ort const [usertype] *pwcs @@

fs/isofs/joliet.c:52:40: expected unsigned short const [usertype] *pwcs
fs/isofs/joliet.c:52:40: got int const [usertype] *<noident>

vim +160 drivers/hv/hv_fcopy.c

01325476d K. Y. Srinivasan 2014-02-16  130  
c7e490fc2 Vitaly Kuznetsov 2015-04-11  131  static void fcopy_send_data(struct work_struct *dummy)
01325476d K. Y. Srinivasan 2014-02-16  132  {
25ef06fe2 Vitaly Kuznetsov 2015-08-01  133  	struct hv_start_fcopy *smsg_out = NULL;
01325476d K. Y. Srinivasan 2014-02-16  134  	int operation = fcopy_transaction.fcopy_msg->operation;
01325476d K. Y. Srinivasan 2014-02-16  135  	struct hv_start_fcopy *smsg_in;
c7e490fc2 Vitaly Kuznetsov 2015-04-11  136  	void *out_src;
c7e490fc2 Vitaly Kuznetsov 2015-04-11  137  	int rc, out_len;
01325476d K. Y. Srinivasan 2014-02-16  138  
01325476d K. Y. Srinivasan 2014-02-16  139  	/*
01325476d K. Y. Srinivasan 2014-02-16  140  	 * The  strings sent from the host are encoded in
01325476d K. Y. Srinivasan 2014-02-16  141  	 * in utf16; convert it to utf8 strings.
01325476d K. Y. Srinivasan 2014-02-16  142  	 * The host assures us that the utf16 strings will not exceed
01325476d K. Y. Srinivasan 2014-02-16  143  	 * the max lengths specified. We will however, reserve room
01325476d K. Y. Srinivasan 2014-02-16  144  	 * for the string terminating character - in the utf16s_utf8s()
01325476d K. Y. Srinivasan 2014-02-16  145  	 * function we limit the size of the buffer where the converted
01325476d K. Y. Srinivasan 2014-02-16  146  	 * string is placed to W_MAX_PATH -1 to guarantee
01325476d K. Y. Srinivasan 2014-02-16  147  	 * that the strings can be properly terminated!
01325476d K. Y. Srinivasan 2014-02-16  148  	 */
01325476d K. Y. Srinivasan 2014-02-16  149  
01325476d K. Y. Srinivasan 2014-02-16  150  	switch (operation) {
01325476d K. Y. Srinivasan 2014-02-16  151  	case START_FILE_COPY:
c7e490fc2 Vitaly Kuznetsov 2015-04-11  152  		out_len = sizeof(struct hv_start_fcopy);
25ef06fe2 Vitaly Kuznetsov 2015-08-01  153  		smsg_out = kzalloc(sizeof(*smsg_out), GFP_KERNEL);
25ef06fe2 Vitaly Kuznetsov 2015-08-01  154  		if (!smsg_out)
25ef06fe2 Vitaly Kuznetsov 2015-08-01  155  			return;
25ef06fe2 Vitaly Kuznetsov 2015-08-01  156  
25ef06fe2 Vitaly Kuznetsov 2015-08-01  157  		smsg_out->hdr.operation = operation;
01325476d K. Y. Srinivasan 2014-02-16  158  		smsg_in = (struct hv_start_fcopy *)fcopy_transaction.fcopy_msg;
01325476d K. Y. Srinivasan 2014-02-16  159  
01325476d K. Y. Srinivasan 2014-02-16 @160  		utf16s_to_utf8s((wchar_t *)smsg_in->file_name, W_MAX_PATH,
01325476d K. Y. Srinivasan 2014-02-16  161  				UTF16_LITTLE_ENDIAN,
25ef06fe2 Vitaly Kuznetsov 2015-08-01  162  				(__u8 *)&smsg_out->file_name, W_MAX_PATH - 1);
01325476d K. Y. Srinivasan 2014-02-16  163  
01325476d K. Y. Srinivasan 2014-02-16  164  		utf16s_to_utf8s((wchar_t *)smsg_in->path_name, W_MAX_PATH,
01325476d K. Y. Srinivasan 2014-02-16  165  				UTF16_LITTLE_ENDIAN,
25ef06fe2 Vitaly Kuznetsov 2015-08-01  166  				(__u8 *)&smsg_out->path_name, W_MAX_PATH - 1);
01325476d K. Y. Srinivasan 2014-02-16  167  
25ef06fe2 Vitaly Kuznetsov 2015-08-01  168  		smsg_out->copy_flags = smsg_in->copy_flags;
25ef06fe2 Vitaly Kuznetsov 2015-08-01  169  		smsg_out->file_size = smsg_in->file_size;
25ef06fe2 Vitaly Kuznetsov 2015-08-01  170  		out_src = smsg_out;
01325476d K. Y. Srinivasan 2014-02-16  171  		break;
01325476d K. Y. Srinivasan 2014-02-16  172  
549e658a0 Olaf Hering      2017-09-21  173  	case WRITE_TO_FILE:
549e658a0 Olaf Hering      2017-09-21  174  		out_src = fcopy_transaction.fcopy_msg;
549e658a0 Olaf Hering      2017-09-21  175  		out_len = sizeof(struct hv_do_fcopy);
549e658a0 Olaf Hering      2017-09-21  176  		break;
01325476d K. Y. Srinivasan 2014-02-16  177  	default:
c7e490fc2 Vitaly Kuznetsov 2015-04-11  178  		out_src = fcopy_transaction.fcopy_msg;
c7e490fc2 Vitaly Kuznetsov 2015-04-11  179  		out_len = fcopy_transaction.recv_len;
01325476d K. Y. Srinivasan 2014-02-16  180  		break;
01325476d K. Y. Srinivasan 2014-02-16  181  	}
c7e490fc2 Vitaly Kuznetsov 2015-04-11  182  
c7e490fc2 Vitaly Kuznetsov 2015-04-11  183  	fcopy_transaction.state = HVUTIL_USERSPACE_REQ;
e0fa3e5e7 Vitaly Kuznetsov 2016-06-09  184  	rc = hvutil_transport_send(hvt, out_src, out_len, NULL);
c7e490fc2 Vitaly Kuznetsov 2015-04-11  185  	if (rc) {
c7e490fc2 Vitaly Kuznetsov 2015-04-11  186  		pr_debug("FCP: failed to communicate to the daemon: %d\n", rc);
c7e490fc2 Vitaly Kuznetsov 2015-04-11  187  		if (cancel_delayed_work_sync(&fcopy_timeout_work)) {
c7e490fc2 Vitaly Kuznetsov 2015-04-11  188  			fcopy_respond_to_host(HV_E_FAIL);
c7e490fc2 Vitaly Kuznetsov 2015-04-11  189  			fcopy_transaction.state = HVUTIL_READY;
c7e490fc2 Vitaly Kuznetsov 2015-04-11  190  		}
c7e490fc2 Vitaly Kuznetsov 2015-04-11  191  	}
25ef06fe2 Vitaly Kuznetsov 2015-08-01  192  	kfree(smsg_out);
01325476d K. Y. Srinivasan 2014-02-16  193  }
01325476d K. Y. Srinivasan 2014-02-16  194  

:::::: The code at line 160 was first introduced by commit
:::::: 01325476d6e46185031be4a9bc6443832dbc807c Drivers: hv: Implement the file copy service

:::::: TO: K. Y. Srinivasan <[email protected]> :::::: CC: Greg Kroah-Hartman <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation