diff options
| author | Len Bao <len.bao@gmx.us> | 2026-05-24 16:52:48 +0000 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2026-05-25 09:31:52 +0200 |
| commit | 5d1d092b8df9aa3c45a58a22e13b92afa850146f (patch) | |
| tree | eea915d4f1a3d0287573d86b185b946d3c80d800 /sound | |
| parent | 055cda1d47960c32e04dcb5d163e4fda7175632e (diff) | |
| download | linux-next-history-5d1d092b8df9aa3c45a58a22e13b92afa850146f.tar.gz | |
ALSA: drivers: Mark some variables as __ro_after_init
Some variables in the 'ALSA/drivers' are initialized only during the
init phase in the '__init' functions and never changed. So, mark them
as __ro_after_init to reduce the attack surface.
Signed-off-by: Len Bao <len.bao@gmx.us>
Link: https://patch.msgid.link/20260524165249.48941-1-len.bao@gmx.us
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
| -rw-r--r-- | sound/drivers/mpu401/mpu401.c | 2 | ||||
| -rw-r--r-- | sound/drivers/pcmtest.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index d3f9424088d4f..b615a310c79ae 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -46,7 +46,7 @@ module_param_array(uart_enter, bool, NULL, 0444); MODULE_PARM_DESC(uart_enter, "Issue UART_ENTER command at open."); static struct platform_device *platform_devices[SNDRV_CARDS]; -static int pnp_registered; +static int pnp_registered __ro_after_init; static unsigned int snd_mpu401_devices; static int snd_mpu401_create(struct device *devptr, int dev, diff --git a/sound/drivers/pcmtest.c b/sound/drivers/pcmtest.c index 7f93557b51eca..5d5281e4deb7c 100644 --- a/sound/drivers/pcmtest.c +++ b/sound/drivers/pcmtest.c @@ -113,7 +113,7 @@ struct pcmtst_buf_iter { struct timer_list timer_instance; }; -static struct snd_pcm_hardware snd_pcmtst_hw = { +static struct snd_pcm_hardware snd_pcmtst_hw __ro_after_init = { .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_NONINTERLEAVED | @@ -137,7 +137,7 @@ struct pattern_buf { u32 len; }; -static int buf_allocated; +static int buf_allocated __ro_after_init; static struct pattern_buf patt_bufs[MAX_CHANNELS_NUM]; static inline void inc_buf_pos(struct pcmtst_buf_iter *v_iter, size_t by, size_t bytes) |
