License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 14:07:57 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2008-07-26 02:45:15 +00:00
|
|
|
#ifndef _OMFS_FS_H
|
|
|
|
#define _OMFS_FS_H
|
|
|
|
|
|
|
|
/* OMFS On-disk structures */
|
|
|
|
|
|
|
|
#define OMFS_MAGIC 0xC2993D87
|
|
|
|
#define OMFS_IMAGIC 0xD2
|
|
|
|
|
|
|
|
#define OMFS_DIR 'D'
|
|
|
|
#define OMFS_FILE 'F'
|
|
|
|
#define OMFS_INODE_NORMAL 'e'
|
|
|
|
#define OMFS_INODE_CONTINUATION 'c'
|
|
|
|
#define OMFS_INODE_SYSTEM 's'
|
|
|
|
#define OMFS_NAMELEN 256
|
|
|
|
#define OMFS_DIR_START 0x1b8
|
|
|
|
#define OMFS_EXTENT_START 0x1d0
|
|
|
|
#define OMFS_EXTENT_CONT 0x40
|
|
|
|
#define OMFS_XOR_COUNT 19
|
|
|
|
#define OMFS_MAX_BLOCK_SIZE 8192
|
2010-07-06 15:16:46 +00:00
|
|
|
#define OMFS_MAX_CLUSTER_SIZE 8
|
2014-10-13 22:54:01 +00:00
|
|
|
#define OMFS_MAX_BLOCKS (1ul << 31)
|
2008-07-26 02:45:15 +00:00
|
|
|
|
|
|
|
struct omfs_super_block {
|
|
|
|
char s_fill1[256];
|
|
|
|
__be64 s_root_block; /* block number of omfs_root_block */
|
|
|
|
__be64 s_num_blocks; /* total number of FS blocks */
|
|
|
|
__be32 s_magic; /* OMFS_MAGIC */
|
|
|
|
__be32 s_blocksize; /* size of a block */
|
|
|
|
__be32 s_mirrors; /* # of mirrors of system blocks */
|
|
|
|
__be32 s_sys_blocksize; /* size of non-data blocks */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct omfs_header {
|
|
|
|
__be64 h_self; /* FS block where this is located */
|
|
|
|
__be32 h_body_size; /* size of useful data after header */
|
|
|
|
__be16 h_crc; /* crc-ccitt of body_size bytes */
|
|
|
|
char h_fill1[2];
|
|
|
|
u8 h_version; /* version, always 1 */
|
|
|
|
char h_type; /* OMFS_INODE_X */
|
|
|
|
u8 h_magic; /* OMFS_IMAGIC */
|
|
|
|
u8 h_check_xor; /* XOR of header bytes before this */
|
|
|
|
__be32 h_fill2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct omfs_root_block {
|
|
|
|
struct omfs_header r_head; /* header */
|
|
|
|
__be64 r_fill1;
|
|
|
|
__be64 r_num_blocks; /* total number of FS blocks */
|
|
|
|
__be64 r_root_dir; /* block # of root directory */
|
|
|
|
__be64 r_bitmap; /* block # of free space bitmap */
|
|
|
|
__be32 r_blocksize; /* size of a block */
|
|
|
|
__be32 r_clustersize; /* size allocated for data blocks */
|
|
|
|
__be64 r_mirrors; /* # of mirrors of system blocks */
|
|
|
|
char r_name[OMFS_NAMELEN]; /* partition label */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct omfs_inode {
|
|
|
|
struct omfs_header i_head; /* header */
|
|
|
|
__be64 i_parent; /* parent containing this inode */
|
|
|
|
__be64 i_sibling; /* next inode in hash bucket */
|
|
|
|
__be64 i_ctime; /* ctime, in milliseconds */
|
|
|
|
char i_fill1[35];
|
|
|
|
char i_type; /* OMFS_[DIR,FILE] */
|
|
|
|
__be32 i_fill2;
|
|
|
|
char i_fill3[64];
|
|
|
|
char i_name[OMFS_NAMELEN]; /* filename */
|
|
|
|
__be64 i_size; /* size of file, in bytes */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct omfs_extent_entry {
|
|
|
|
__be64 e_cluster; /* start location of a set of blocks */
|
|
|
|
__be64 e_blocks; /* number of blocks after e_cluster */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct omfs_extent {
|
|
|
|
__be64 e_next; /* next extent table location */
|
|
|
|
__be32 e_extent_count; /* total # extents in this table */
|
|
|
|
__be32 e_fill;
|
fs: omfs: Use flexible-array member in struct omfs_extent
Memory for 'struct omfs_extent' and a 'e_extent_count' number of extent
entries is indirectly allocated through 'bh->b_data', which is a pointer
to data within the page. This implies that the member 'e_entry'
(which is the start of extent entries) functions more like an array than
a single object of type 'struct omfs_extent_entry'.
So we better turn this object into a proper array, in this case a
flexible-array member, and with that, fix the following
-Wstringop-overflow warning seen after building s390 architecture with
allyesconfig (GCC 13):
fs/omfs/file.c: In function 'omfs_grow_extent':
include/linux/fortify-string.h:57:33: warning: writing 16 bytes into a region of size 0 [-Wstringop-overflow=]
57 | #define __underlying_memcpy __builtin_memcpy
| ^
include/linux/fortify-string.h:648:9: note: in expansion of macro '__underlying_memcpy'
648 | __underlying_##op(p, q, __fortify_size); \
| ^~~~~~~~~~~~~
include/linux/fortify-string.h:693:26: note: in expansion of macro '__fortify_memcpy_chk'
693 | #define memcpy(p, q, s) __fortify_memcpy_chk(p, q, s, \
| ^~~~~~~~~~~~~~~~~~~~
fs/omfs/file.c:170:9: note: in expansion of macro 'memcpy'
170 | memcpy(terminator, entry, sizeof(struct omfs_extent_entry));
| ^~~~~~
In file included from fs/omfs/omfs.h:8,
from fs/omfs/file.c:11:
fs/omfs/omfs_fs.h:80:34: note: at offset 16 into destination object 'e_entry' of size 16
80 | struct omfs_extent_entry e_entry; /* start of extent entries */
| ^~~~~~~
There are some binary differences before and after changes, but this are
expected due to the change in the size of 'struct omfs_extent' and the
necessary adjusments.
This helps with the ongoing efforts to globally enable
-Wstringop-overflow.
Link: https://github.com/KSPP/linux/issues/330
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2023-07-14 19:56:37 +00:00
|
|
|
struct omfs_extent_entry e_entry[]; /* start of extent entries */
|
2008-07-26 02:45:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|