No description
Find a file
Gustavo A. R. Silva 2a7f0e53da ima: ima_api: Use struct_size() in kzalloc()
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:

struct ima_template_entry {
	...
        struct ima_field_data template_data[0]; /* template related data */
};

instance = kzalloc(sizeof(struct ima_template_entry) + count * sizeof(struct ima_field_data), GFP_NOFS);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = kzalloc(struct_size(instance, entry, count), GFP_NOFS);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2019-08-29 14:23:30 -04:00
arch MODSIGN: Export module signature definitions 2019-08-05 18:39:56 -04:00
block for-linus-20190726-2 2019-07-26 19:20:34 -07:00
certs PKCS#7: Refactor verify_pkcs7_signature() 2019-08-05 18:40:18 -04:00
crypto PKCS#7: Introduce pkcs7_get_digest() 2019-08-05 18:40:19 -04:00
Documentation ima: Define ima-modsig template 2019-08-05 18:40:25 -04:00
drivers Char/Misc driver fixes for 5.3-rc2 2019-07-28 10:26:10 -07:00
fs SPDX fixes for 5.3-rc2 2019-07-28 10:00:06 -07:00
include MODSIGN: make new include file self contained 2019-08-06 13:41:04 -04:00
init MODSIGN: Export module signature definitions 2019-08-05 18:39:56 -04:00
ipc
kernel MODSIGN: Export module signature definitions 2019-08-05 18:39:56 -04:00
lib
LICENSES
mm
net
samples
scripts MODSIGN: Export module signature definitions 2019-08-05 18:39:56 -04:00
security ima: ima_api: Use struct_size() in kzalloc() 2019-08-29 14:23:30 -04:00
sound sound fixes for 5.3-rc2 2019-07-26 10:23:45 -07:00
tools sefltest/ima: support appended signatures (modsig) 2019-08-29 12:45:30 -04:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore .gitignore: Add compilation database file 2019-07-27 12:18:19 +09:00
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS Char/Misc driver fixes for 5.3-rc2 2019-07-28 10:26:10 -07:00
Makefile Linux 5.3-rc2 2019-07-28 12:47:02 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.