Skip to content

Commit

Permalink
Avoid using variable-length arrays in kernel/sys.c
Browse files Browse the repository at this point in the history
The size is always valid, but variable-length arrays generate worse code
for no good reason (unless the function happens to be inlined and the
compiler sees the length for the simple constant it is).

Also, there seems to be some code generation problem on POWER, where
Henrik Bakken reports that register r28 can get corrupted under some
subtle circumstances (interrupt happening at the wrong time?).  That all
indicates some seriously broken compiler issues, but since variable
length arrays are bad regardless, there's little point in trying to
chase it down.

"Just don't do that, then".

Reported-by: Henrik Grindal Bakken <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Oct 17, 2011
1 parent 8bc03e8 commit a84a79e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ DECLARE_RWSEM(uts_sem);
static int override_release(char __user *release, int len)
{
int ret = 0;
char buf[len];
char buf[65];

if (current->personality & UNAME26) {
char *rest = UTS_RELEASE;
Expand Down

0 comments on commit a84a79e

Please sign in to comment.