On 2020/05/19 12:31, Xiaoming Ni wrote:
> Some boundary (.extra1 .extra2) constants (E.g: neg_one two) in
> sysctl.c are used in multiple features. Move these variables to
> sysctl_vals to avoid adding duplicate variables when cleaning up
> sysctls table.
> 
> Signed-off-by: Xiaoming Ni <[email protected]>
> Reviewed-by: Kees Cook <[email protected]>

I feel that it is use of

        void *extra1;
        void *extra2;

in "struct ctl_table" that requires constant values indirection.
Can't we get rid of sysctl_vals using some "union" like below?

struct ctl_table {
        const char *procname;           /* Text ID for /proc/sys, or zero */
        void *data;
        int maxlen;
        umode_t mode;
        struct ctl_table *child;        /* Deprecated */
        proc_handler *proc_handler;     /* Callback for text formatting */
        struct ctl_table_poll *poll;
        union {
                void *min_max_ptr[2];
                int min_max_int[2];
                long min_max_long[2];
        };
} __randomize_layout;

Reply via email to