lkml.org 
[lkml]   [2022]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] [next] pcmcia: synclink_cs: replace 1-element array with flex-array member
On Wed, Dec 14, 2022 at 10:58 AM Paulo Miguel Almeida
<paulo.miguel.almeida.rodenas@gmail.com> wrote:
>
> One-element arrays are deprecated, and we are replacing them with
> flexible array members instead. So, replace one-element array with
> flexible-array member in struct RXBUF. No changes were required
> within the source code because of the existing padding in RXBUF struct

You shouldn't rely on padding. Make you change robust independently on
the padding. See also below.

> It's worth mentioning that doing a build before/after this patch
> results in no binary output differences.

This is interesting...

> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> routines on memcpy() and help us make progress towards globally
> enabling -fstrict-flex-arrays=3 [1].
>
> Link: https://github.com/KSPP/linux/issues/79
> Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]

>

The blank lines are not allowed in the tag block (in case you want to
have Link: to be recognized as a tag).

> Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> ---
> Changelog:
>
> - v2: removed changes to how the size of RXBUF was calculated. I
> changed my mind after thinking about the existing padding in the
> struct. Happy to discuss it if anyone sees it differently.

I feel worried about in particular this code:

/* each buffer has header and data */
info->rx_buf_size = sizeof(RXBUF) + info->max_frame_size;

which means that entire rx_alloc_buffers() should be revisited. Also
take into account the use of one or more macros from overflow.h for
memory allocation.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2022-12-14 11:45    [W:0.092 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site