Re: [PATCH] kernel/sysctl_binary.c: improve the usage of return value 'result'

From: Eric W. Biederman
Date: Tue Aug 06 2013 - 17:46:43 EST

Chen Gang <gang.chen@xxxxxxxxxxx> writes:

Have you tested this code? Do you have anything that actually the
uses sysctl binary interface?

If you do have code that actually uses this interface please fix it not
to use it. This code is fundamentally a stop gap measure and will
bit-rot in time and then we will remove it.

> Improve the usage of return value 'result', so not only can make code
> clearer to readers, but also can improve the performance.
> Assign the return error code only when error occurs, so can save some
> instructions (some of them are inside looping).

That actually is a code pessimization, not an optimization. As are most
of your proposed changes. Only assigning the error code simply can not
generate better assembly code.

> Rewrite the sysctl_getname() to make code clearer to readers, and also
> can save some instructions (it is mainly related with the usage of the
> variable 'result').

Again you are introducing branches and pessimizing the code in the name
of optimization.

> Remove useless variable 'result' for sysctl() and compat sysctl(), when
> do_sysctl() fails, it is meaningless to assign 'oldlenp ' with original
> same value.

> Also modify the related code to pass "./scripts/" checking.

I really don't care about at this point.

The right answer to the code is to config it out and then you don't have
to worry about it one way or another.

The sysctl binary path has never been properly maintained and I don't
intend to start. But I will spend 5 minutes to say this patch seems to
make the code worse not better.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at