mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 14:41:39 +00:00
5224f79096
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. This code was transformed with the help of Coccinelle: (next-20220214$ spatch --jobs $(getconf _NPROCESSORS_ONLN) --sp-file script.cocci --include-headers --dir . > output.patch) @@ identifier S, member, array; type T1, T2; @@ struct S { ... T1 member; T2 array[ - 0 ]; }; UAPI and wireless changes were intentionally excluded from this patch and will be sent out separately. [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.16/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/78 Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
/*
|
|
* include/asm-xtensa/bootparam.h
|
|
*
|
|
* Definition of the Linux/Xtensa boot parameter structure
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2001 - 2005 Tensilica Inc.
|
|
*
|
|
* (Concept borrowed from the 68K port)
|
|
*/
|
|
|
|
#ifndef _XTENSA_BOOTPARAM_H
|
|
#define _XTENSA_BOOTPARAM_H
|
|
|
|
#define BP_VERSION 0x0001
|
|
|
|
#define BP_TAG_COMMAND_LINE 0x1001 /* command line (0-terminated string)*/
|
|
#define BP_TAG_INITRD 0x1002 /* ramdisk addr and size (bp_meminfo) */
|
|
#define BP_TAG_MEMORY 0x1003 /* memory addr and size (bp_meminfo) */
|
|
#define BP_TAG_SERIAL_BAUDRATE 0x1004 /* baud rate of current console. */
|
|
#define BP_TAG_SERIAL_PORT 0x1005 /* serial device of current console */
|
|
#define BP_TAG_FDT 0x1006 /* flat device tree addr */
|
|
|
|
#define BP_TAG_FIRST 0x7B0B /* first tag with a version number */
|
|
#define BP_TAG_LAST 0x7E0B /* last tag */
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
/* All records are aligned to 4 bytes */
|
|
|
|
typedef struct bp_tag {
|
|
unsigned short id; /* tag id */
|
|
unsigned short size; /* size of this record excluding the structure*/
|
|
unsigned long data[]; /* data */
|
|
} bp_tag_t;
|
|
|
|
struct bp_meminfo {
|
|
unsigned long type;
|
|
unsigned long start;
|
|
unsigned long end;
|
|
};
|
|
|
|
#define MEMORY_TYPE_CONVENTIONAL 0x1000
|
|
#define MEMORY_TYPE_NONE 0x2000
|
|
|
|
#endif
|
|
#endif
|