[Skiboot] [PATCH 02/51] ffspart, libflash: Fix stack size warnings

Andrew Jeffery andrew at aj.id.au
Mon Feb 18 13:37:44 AEDT 2019



On Mon, 18 Feb 2019, at 11:31, Stewart Smith wrote:
> Andrew Jeffery <andrew at aj.id.au> writes:
> >     libflash/file.c: In function 'file_erase':
> >     libflash/file.c:134:1: error: the frame size of 4128 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> >      }
> >      ^
> >
> > and
> >
> >     ffspart.c: In function ‘main’:
> >     ffspart.c:529:1: error: the frame size of 4864 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> >      }
> >      ^
> >
> > In both cases, mark the local variables as static to avoid the stack.
> 
> If I was to bikeshed I'd say we could malloc() instead, but this way
> seems otherwise fine.

Can't forget to free() if you never malloc() :)

> 
> > The static approach is valid for file.c as the buffer is always filled
> > with `~0`. Given it's now going to be in .bss due to static we have to
> > still perform the memset(), but racing memset()s in this fashion won't
> > be harmful, just wasteful.
> 
> Part of me hurts reading it, the other part is "meh, fair enough".

Yeah. It was the least invasive change I could make to fix the issue. Hard
to beat adding one word.

> 
> I'm guessing this is because when we build from skiboot's makefile we
> end up with the skiboot CFLAGS which are a lot more restrictive than the
> CFLAGS in external/ ?

I guess so? I didn't dig too deep.


More information about the Skiboot mailing list