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

Stewart Smith stewart at linux.ibm.com
Mon Feb 18 12:01:12 AEDT 2019

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.

> 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".

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/ ?

Stewart Smith
OPAL Architect, IBM.

More information about the Skiboot mailing list