Re: [PATCH net-next v6 8/8] ax.25: x.25: Remove the now superfluous sentinel elements from ctl_table array

From: Sabrina Dubroca
Date: Wed May 01 2024 - 09:16:37 EST


2024-05-01, 11:29:32 +0200, Joel Granados via B4 Relay wrote:
> From: Joel Granados <j.granados@xxxxxxxxxxx>
>
> This commit comes at the tail end of a greater effort to remove the
> empty elements at the end of the ctl_table arrays (sentinels) which will
> reduce the overall build time size of the kernel and run time memory
> bloat by ~64 bytes per sentinel (further information Link :
> https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@xxxxxxxxxxxxxxxxxxxxxx/)
>
> Avoid a buffer overflow when traversing the ctl_table by ensuring that
> AX25_MAX_VALUES is the same as the size of ax25_param_table. This is
> done with a BUILD_BUG_ON where ax25_param_table is defined and a
> CONFIG_AX25_DAMA_SLAVE guard in the unnamed enum definition as well as
> in the ax25_dev_device_up and ax25_ds_set_timer functions.
^^
nit: not anymore ;)
(but not worth a repost IMO)


> diff --git a/net/ax25/ax25_ds_timer.c b/net/ax25/ax25_ds_timer.c
> index c4f8adbf8144..c50a58d9e368 100644
> --- a/net/ax25/ax25_ds_timer.c
> +++ b/net/ax25/ax25_ds_timer.c
> @@ -55,6 +55,7 @@ void ax25_ds_set_timer(ax25_dev *ax25_dev)
> ax25_dev->dama.slave_timeout =
> msecs_to_jiffies(ax25_dev->values[AX25_VALUES_DS_TIMEOUT]) / 10;
> mod_timer(&ax25_dev->dama.slave_timer, jiffies + HZ);
> + return;

nit: return not needed here since we're already at the bottom of the
function, but probably not worth a repost of the series.

> }

--
Sabrina