All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] flexible-array member convertion patches for 5.7-rc2
@ 2020-04-18 21:38 Gustavo A. R. Silva
  2020-04-19 19:20 ` pr-tracker-bot
  2020-04-20  1:12 ` Stephen Rothwell
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2020-04-18 21:38 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Kees Cook, Greg KH, linux-kernel, Gustavo A. R. Silva

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(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] flexible-array member convertion patches for 5.7-rc2
  2020-04-18 21:38 [GIT PULL] flexible-array member convertion patches for 5.7-rc2 Gustavo A. R. Silva
@ 2020-04-19 19:20 ` pr-tracker-bot
  2020-04-20  1:12 ` Stephen Rothwell
  1 sibling, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2020-04-19 19:20 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Linus Torvalds, Kees Cook, Greg KH, linux-kernel, Gustavo A. R. Silva

The pull request you sent on Sat, 18 Apr 2020 16:38:28 -0500:

> git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git tags/flexible-array-member-5.7-rc2

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/13402837414070492004cd0a9c80b5fcebbd1a9e

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] flexible-array member convertion patches for 5.7-rc2
  2020-04-18 21:38 [GIT PULL] flexible-array member convertion patches for 5.7-rc2 Gustavo A. R. Silva
  2020-04-19 19:20 ` pr-tracker-bot
@ 2020-04-20  1:12 ` Stephen Rothwell
  2020-04-20  4:54   ` Gustavo A. R. Silva
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2020-04-20  1:12 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Linus Torvalds, Kees Cook, Greg KH, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi Gustavo,

On Sat, 18 Apr 2020 16:38:28 -0500 "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
>
> 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.

Except that you rebased these just yesterday :-(

I understand why you did that (because there are still three earlier
patches in the linux-next version of this tree), but please try to
avoid this in the future.

Also, please clean up your linux-next included branch to avoid
conflicts in the future, thanks.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] flexible-array member convertion patches for 5.7-rc2
  2020-04-20  1:12 ` Stephen Rothwell
@ 2020-04-20  4:54   ` Gustavo A. R. Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2020-04-20  4:54 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Linus Torvalds, Kees Cook, Greg KH, linux-kernel

Hi Stephen,

On 4/19/20 20:12, Stephen Rothwell wrote:
> Hi Gustavo,
> 
> On Sat, 18 Apr 2020 16:38:28 -0500 "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
>>
>> 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.
> 
> Except that you rebased these just yesterday :-(
> 
> I understand why you did that (because there are still three earlier
> patches in the linux-next version of this tree), but please try to
> avoid this in the future.
> 

That's correct.  I'm sorry for any trouble that may have caused you.
I will try to avoid doing that in the future.

> Also, please clean up your linux-next included branch to avoid
> conflicts in the future, thanks.
> 

Done! :)

Thanks
--
Gustavo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-20  5:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 21:38 [GIT PULL] flexible-array member convertion patches for 5.7-rc2 Gustavo A. R. Silva
2020-04-19 19:20 ` pr-tracker-bot
2020-04-20  1:12 ` Stephen Rothwell
2020-04-20  4:54   ` Gustavo A. R. Silva

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.