From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>,
Greg KH <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [GIT PULL] flexible-array member convertion patches for 5.7-rc2
Date: Sat, 18 Apr 2020 16:38:28 -0500 [thread overview]
Message-ID: <20200418213828.GA10666@embeddedor> (raw)
The following changes since commit 8f3d9f354286745c751374f5f1fcafee6b3f3136:
Linux 5.7-rc1 (2020-04-12 12:35:55 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-member-5.7-rc2
for you to fetch changes up to 43951585e1308b322c8ee31a4aafd08213f5c5d7:
xattr.h: Replace zero-length array with flexible-array member (2020-04-18 15:44:56 -0500)
----------------------------------------------------------------
flexible-array member convertion patches for 5.7-rc2
Hi Linus,
Please, pull the following patches that replace zero-length arrays with
flexible-array members.
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:
struct foo {
int stuff;
struct boo array[];
};
By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.
Also, notice that, dynamic memory allocations won't be affected by
this change:
"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]
sizeof(flexible-array-member) triggers a warning because flexible array
members have incomplete type[1]. There are some instances of code in
which the sizeof operator is being incorrectly/erroneously applied to
zero-length arrays and the result is zero. Such instances may be hiding
some bugs. So, this work (flexible-array member convertions) will also
help to get completely rid of those sorts of issues.
Notice that all of these patches have been baking in linux-next for
quite a while now and, 238 more of these patches have already been
merged into 5.7-rc1.
There are a couple hundred more of these issues waiting to be addressed
in the whole codebase.
[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")
Thanks
----------------------------------------------------------------
Gustavo A. R. Silva (28):
bio: Replace zero-length array with flexible-array member
blk-mq: Replace zero-length array with flexible-array member
blk_types: Replace zero-length array with flexible-array member
can: dev: peak_canfd.h: Replace zero-length array with flexible-array member
digsig.h: Replace zero-length array with flexible-array member
dirent.h: Replace zero-length array with flexible-array member
enclosure.h: Replace zero-length array with flexible-array member
energy_model.h: Replace zero-length array with flexible-array member
ethtool.h: Replace zero-length array with flexible-array member
genalloc.h: Replace zero-length array with flexible-array member
igmp.h: Replace zero-length array with flexible-array member
ihex.h: Replace zero-length array with flexible-array member
irq.h: Replace zero-length array with flexible-array member
lib: cpu_rmap: Replace zero-length array with flexible-array member
list_lru.h: Replace zero-length array with flexible-array member
memcontrol.h: Replace zero-length array with flexible-array member
platform_data: wilco-ec.h: Replace zero-length array with flexible-array member
posix_acl.h: Replace zero-length array with flexible-array member
rio.h: Replace zero-length array with flexible-array member
rslib.h: Replace zero-length array with flexible-array member
sched: topology.h: Replace zero-length array with flexible-array member
skbuff.h: Replace zero-length array with flexible-array member
swap.h: Replace zero-length array with flexible-array member
ti_wilink_st.h: Replace zero-length array with flexible-array member
tpm_eventlog.h: Replace zero-length array with flexible-array member
uapi: linux: dlm_device.h: Replace zero-length array with flexible-array member
uapi: linux: fiemap.h: Replace zero-length array with flexible-array member
xattr.h: Replace zero-length array with flexible-array member
include/linux/bio.h | 2 +-
include/linux/blk-mq.h | 2 +-
include/linux/blk_types.h | 2 +-
include/linux/can/dev/peak_canfd.h | 4 ++--
include/linux/cpu_rmap.h | 2 +-
include/linux/digsig.h | 4 ++--
include/linux/dirent.h | 2 +-
include/linux/enclosure.h | 2 +-
include/linux/energy_model.h | 2 +-
include/linux/ethtool.h | 4 ++--
include/linux/genalloc.h | 2 +-
include/linux/igmp.h | 2 +-
include/linux/ihex.h | 2 +-
include/linux/irq.h | 4 ++--
include/linux/list_lru.h | 2 +-
include/linux/memcontrol.h | 4 ++--
include/linux/platform_data/wilco-ec.h | 2 +-
include/linux/posix_acl.h | 2 +-
include/linux/rio.h | 4 ++--
include/linux/rslib.h | 2 +-
include/linux/sched/topology.h | 2 +-
include/linux/skbuff.h | 2 +-
include/linux/swap.h | 2 +-
include/linux/ti_wilink_st.h | 6 +++---
include/linux/tpm_eventlog.h | 6 +++---
include/linux/xattr.h | 2 +-
include/uapi/linux/dlm_device.h | 4 ++--
include/uapi/linux/fiemap.h | 2 +-
28 files changed, 39 insertions(+), 39 deletions(-)
next reply other threads:[~2020-04-18 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-18 21:38 Gustavo A. R. Silva [this message]
2020-04-19 19:20 ` [GIT PULL] flexible-array member convertion patches for 5.7-rc2 pr-tracker-bot
2020-04-20 1:12 ` Stephen Rothwell
2020-04-20 4:54 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200418213828.GA10666@embeddedor \
--to=gustavo@embeddedor.com \
--cc=gregkh@linuxfoundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.