[alsa-devel] [PATCH 00/31] Constify hw_constrains

Hi,
this is a very trivial patchset for adding const prefix to some static PCM hw constraints. Just for hardening.
The similar patchset for ASoC will follow later.
thanks,
Takashi
===
Takashi Iwai (31): ALSA: cs423x: Constify hw_constraints ALSA: es1688: Constify hw_constraints ALSA: es18xx: Constify hw_constraints ALSA: gus: Constify hw_constraints ALSA: sb: Constify hw_constraints ALSA: wss: Constify hw_constraints ALSA: parisc: Constify hw_constraints ALSA: ali5451: Constify hw_constraints ALSA: atiixp: Constify hw_constraints ALSA: au88x0: Constify hw_constraints ALSA: azt3328: Constify hw_constraints ALSA: bt87x: Constify hw_constraints ALSA: cmipci: Constify hw_constraints ALSA: cs46xx: Constify hw_constraints ALSA: emu10k1: Constify hw_constraints ALSA: fm801: Constify hw_constraints ALSA: ens137x: Constify hw_constraints ALSA: es1938: Constify hw_constraints ALSA: hda: Constify hw_constraints ALSA: ice1712: Constify hw_constraints ALSA: ice1724: Constify hw_constraints ALSA: intel8x0: Constify hw_constraints ALSA: nm256: Constify hw_constraints ALSA: rme32: Constify hw_constraints ALSA: rme96: Constify hw_constraints ALSA: hdsp: Constify hw_constraints ALSA: hdspm: Constify hw_constraints ALSA: rme9652: Constify hw_constraints ALSA: sonicvibes: Constify hw_constraints ALSA: via82xx: Constify hw_constraints ALSA: sparc: Constify hw_constraints
sound/isa/cs423x/cs4236_lib.c | 4 ++-- sound/isa/es1688/es1688_lib.c | 4 ++-- sound/isa/es18xx.c | 8 ++++---- sound/isa/gus/gus_pcm.c | 4 ++-- sound/isa/sb/sb8_main.c | 6 +++--- sound/isa/wss/wss_lib.c | 4 ++-- sound/parisc/harmony.c | 6 +++--- sound/pci/ali5451/ali5451.c | 4 ++-- sound/pci/atiixp_modem.c | 4 ++-- sound/pci/au88x0/au88x0_pcm.c | 4 ++-- sound/pci/azt3328.c | 4 ++-- sound/pci/bt87x.c | 4 ++-- sound/pci/cmipci.c | 12 ++++++------ sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- sound/pci/emu10k1/emupcm.c | 8 ++++---- sound/pci/ens1370.c | 16 ++++++++-------- sound/pci/es1938.c | 4 ++-- sound/pci/fm801.c | 8 ++++---- sound/pci/hda/patch_hdmi.c | 10 +++++----- sound/pci/hda/patch_si3054.c | 4 ++-- sound/pci/ice1712/ice1712.c | 4 ++-- sound/pci/ice1712/ice1712.h | 2 +- sound/pci/ice1712/ice1724.c | 8 ++++---- sound/pci/ice1712/juli.c | 6 +++--- sound/pci/ice1712/maya44.c | 4 ++-- sound/pci/ice1712/quartet.c | 6 +++--- sound/pci/intel8x0.c | 12 ++++++------ sound/pci/intel8x0m.c | 4 ++-- sound/pci/nm256/nm256.c | 4 ++-- sound/pci/rme32.c | 5 ++--- sound/pci/rme96.c | 4 ++-- sound/pci/rme9652/hdsp.c | 8 ++++---- sound/pci/rme9652/hdspm.c | 4 ++-- sound/pci/rme9652/rme9652.c | 4 ++-- sound/pci/sonicvibes.c | 4 ++-- sound/pci/via82xx.c | 4 ++-- sound/pci/via82xx_modem.c | 4 ++-- sound/sparc/cs4231.c | 4 ++-- 38 files changed, 106 insertions(+), 107 deletions(-)

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/cs423x/cs4236_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 2b7cc596f4c6..2012936f6756 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -138,7 +138,7 @@ static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg)
#define CLOCKS 8
-static struct snd_ratnum clocks[CLOCKS] = { +static const struct snd_ratnum clocks[CLOCKS] = { { .num = 16934400, .den_min = 353, .den_max = 353, .den_step = 1 }, { .num = 16934400, .den_min = 529, .den_max = 529, .den_step = 1 }, { .num = 16934400, .den_min = 617, .den_max = 617, .den_step = 1 }, @@ -149,7 +149,7 @@ static struct snd_ratnum clocks[CLOCKS] = { { .num = 16934400/16, .den_min = 21, .den_max = 192, .den_step = 1 } };
-static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { +static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { .nrats = CLOCKS, .rats = clocks, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/es1688/es1688_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c index 81cf26fa28d6..5d3df96c5e5b 100644 --- a/sound/isa/es1688/es1688_lib.c +++ b/sound/isa/es1688/es1688_lib.c @@ -290,7 +290,7 @@ static int snd_es1688_init(struct snd_es1688 * chip, int enable)
*/
-static struct snd_ratnum clocks[2] = { +static const struct snd_ratnum clocks[2] = { { .num = 795444, .den_min = 1, @@ -305,7 +305,7 @@ static struct snd_ratnum clocks[2] = { } };
-static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { +static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { .nrats = 2, .rats = clocks, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/es18xx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 0cabe2b8974f..ae17a6584061 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -369,7 +369,7 @@ static int snd_es18xx_reset_fifo(struct snd_es18xx *chip) return 0; }
-static struct snd_ratnum new_clocks[2] = { +static const struct snd_ratnum new_clocks[2] = { { .num = 793800, .den_min = 1, @@ -384,12 +384,12 @@ static struct snd_ratnum new_clocks[2] = { } };
-static struct snd_pcm_hw_constraint_ratnums new_hw_constraints_clocks = { +static const struct snd_pcm_hw_constraint_ratnums new_hw_constraints_clocks = { .nrats = 2, .rats = new_clocks, };
-static struct snd_ratnum old_clocks[2] = { +static const struct snd_ratnum old_clocks[2] = { { .num = 795444, .den_min = 1, @@ -404,7 +404,7 @@ static struct snd_ratnum old_clocks[2] = { } };
-static struct snd_pcm_hw_constraint_ratnums old_hw_constraints_clocks = { +static const struct snd_pcm_hw_constraint_ratnums old_hw_constraints_clocks = { .nrats = 2, .rats = old_clocks, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/gus/gus_pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index b9f6dcbef889..6b3da01a93b7 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -562,14 +562,14 @@ static snd_pcm_uframes_t snd_gf1_pcm_playback_pointer(struct snd_pcm_substream * return pos; }
-static struct snd_ratnum clock = { +static const struct snd_ratnum clock = { .num = 9878400/16, .den_min = 2, .den_max = 257, .den_step = 1, };
-static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { +static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { .nrats = 1, .rats = &clock, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/sb/sb8_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/isa/sb/sb8_main.c b/sound/isa/sb/sb8_main.c index 9043397fe62f..0f302be4fb6d 100644 --- a/sound/isa/sb/sb8_main.c +++ b/sound/isa/sb/sb8_main.c @@ -46,19 +46,19 @@ MODULE_LICENSE("GPL"); #define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v)) #define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v))
-static struct snd_ratnum clock = { +static const struct snd_ratnum clock = { .num = SB8_CLOCK, .den_min = 1, .den_max = 256, .den_step = 1, };
-static struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = { +static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = { .nrats = 1, .rats = &clock, };
-static struct snd_ratnum stereo_clocks[] = { +static const struct snd_ratnum stereo_clocks[] = { { .num = SB8_CLOCK, .den_min = SB8_DEN(22050),

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/isa/wss/wss_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 913b731d2236..9f4e2e34cbe1 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c @@ -69,12 +69,12 @@ static unsigned char freq_bits[14] = { /* 48000 */ 0x0C | CS4231_XTAL1 };
-static unsigned int rates[14] = { +static const unsigned int rates[14] = { 5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050, 27042, 32000, 33075, 37800, 44100, 48000 };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/parisc/harmony.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c index 99b64cb3cef8..5911eb35c2a3 100644 --- a/sound/parisc/harmony.c +++ b/sound/parisc/harmony.c @@ -83,14 +83,14 @@ MODULE_DEVICE_TABLE(parisc, snd_harmony_devtable); #define NAME "harmony" #define PFX NAME ": "
-static unsigned int snd_harmony_rates[] = { +static const unsigned int snd_harmony_rates[] = { 5512, 6615, 8000, 9600, 11025, 16000, 18900, 22050, 27428, 32000, 33075, 37800, 44100, 48000 };
-static unsigned int rate_bits[14] = { +static const unsigned int rate_bits[14] = { HARMONY_SR_5KHZ, HARMONY_SR_6KHZ, HARMONY_SR_8KHZ, HARMONY_SR_9KHZ, HARMONY_SR_11KHZ, HARMONY_SR_16KHZ, HARMONY_SR_18KHZ, HARMONY_SR_22KHZ, HARMONY_SR_27KHZ, @@ -98,7 +98,7 @@ static unsigned int rate_bits[14] = { HARMONY_SR_44KHZ, HARMONY_SR_48KHZ };
-static struct snd_pcm_hw_constraint_list hw_constraint_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraint_rates = { .count = ARRAY_SIZE(snd_harmony_rates), .list = snd_harmony_rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ali5451/ali5451.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 34bbc2e730a6..8567f1e5b9cf 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -1602,8 +1602,8 @@ static struct snd_pcm_hardware snd_ali_modem = static int snd_ali_modem_open(struct snd_pcm_substream *substream, int rec, int channel) { - static unsigned int rates[] = {8000, 9600, 12000, 16000}; - static struct snd_pcm_hw_constraint_list hw_constraint_rates = { + static const unsigned int rates[] = {8000, 9600, 12000, 16000}; + static const struct snd_pcm_hw_constraint_list hw_constraint_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/atiixp_modem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 40152feef1e7..52e0ea7b9b80 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -860,8 +860,8 @@ static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream, struct atiixp_modem *chip = snd_pcm_substream_chip(substream); struct snd_pcm_runtime *runtime = substream->runtime; int err; - static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; - static struct snd_pcm_hw_constraint_list hw_constraints_rates = { + static const unsigned int rates[] = { 8000, 9600, 12000, 16000 }; + static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/au88x0/au88x0_pcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c index 335979a753fe..1aa97012451d 100644 --- a/sound/pci/au88x0/au88x0_pcm.c +++ b/sound/pci/au88x0/au88x0_pcm.c @@ -112,11 +112,11 @@ static struct snd_pcm_hardware snd_vortex_playback_hw_wt = { }; #endif #ifdef CHIP_AU8830 -static unsigned int au8830_channels[3] = { +static const unsigned int au8830_channels[3] = { 1, 2, 4, };
-static struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = { +static const struct snd_pcm_hw_constraint_list hw_constraints_au8830_channels = { .count = ARRAY_SIZE(au8830_channels), .list = au8830_channels, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/azt3328.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 79b2e6b7d88b..fc18c29a8173 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c @@ -2014,7 +2014,7 @@ static const struct snd_pcm_hardware snd_azf3328_hardware = };
-static unsigned int snd_azf3328_fixed_rates[] = { +static const unsigned int snd_azf3328_fixed_rates[] = { AZF_FREQ_4000, AZF_FREQ_4800, AZF_FREQ_5512, @@ -2031,7 +2031,7 @@ static unsigned int snd_azf3328_fixed_rates[] = { AZF_FREQ_66200 };
-static struct snd_pcm_hw_constraint_list snd_azf3328_hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list snd_azf3328_hw_constraints_rates = { .count = ARRAY_SIZE(snd_azf3328_fixed_rates), .list = snd_azf3328_fixed_rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/bt87x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 099efb046b1c..de0234294c25 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c @@ -401,13 +401,13 @@ static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runti
static int snd_bt87x_set_analog_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime) { - static struct snd_ratnum analog_clock = { + static const struct snd_ratnum analog_clock = { .num = ANALOG_CLOCK, .den_min = CLOCK_DIV_MIN, .den_max = CLOCK_DIV_MAX, .den_step = 1 }; - static struct snd_pcm_hw_constraint_ratnums constraint_rates = { + static const struct snd_pcm_hw_constraint_ratnums constraint_rates = { .nrats = 1, .rats = &analog_clock };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/cmipci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 745a0a3743b4..a460cb63e971 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -719,18 +719,18 @@ static int snd_cmipci_hw_free(struct snd_pcm_substream *substream) /* */
-static unsigned int hw_channels[] = {1, 2, 4, 6, 8}; -static struct snd_pcm_hw_constraint_list hw_constraints_channels_4 = { +static const unsigned int hw_channels[] = {1, 2, 4, 6, 8}; +static const struct snd_pcm_hw_constraint_list hw_constraints_channels_4 = { .count = 3, .list = hw_channels, .mask = 0, }; -static struct snd_pcm_hw_constraint_list hw_constraints_channels_6 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_channels_6 = { .count = 4, .list = hw_channels, .mask = 0, }; -static struct snd_pcm_hw_constraint_list hw_constraints_channels_8 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_channels_8 = { .count = 5, .list = hw_channels, .mask = 0, @@ -1597,9 +1597,9 @@ static struct snd_pcm_hardware snd_cmipci_capture_spdif = .fifo_size = 0, };
-static unsigned int rate_constraints[] = { 5512, 8000, 11025, 16000, 22050, +static const unsigned int rate_constraints[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96000, 128000 }; -static struct snd_pcm_hw_constraint_list hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rate_constraints), .list = rate_constraints, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/cs46xx/cs46xx_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index ae2aad52ea6f..709fb1a503b7 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c @@ -1482,9 +1482,9 @@ static struct snd_pcm_hardware snd_cs46xx_capture =
#ifdef CONFIG_SND_CS46XX_NEW_DSP
-static unsigned int period_sizes[] = { 32, 64, 128, 256, 512, 1024, 2048 }; +static const unsigned int period_sizes[] = { 32, 64, 128, 256, 512, 1024, 2048 };
-static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = { +static const struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = { .count = ARRAY_SIZE(period_sizes), .list = period_sizes, .mask = 0

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/emu10k1/emupcm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index bdda29f335f6..5c9054a9f69e 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c @@ -164,7 +164,7 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic return 0; }
-static unsigned int capture_period_sizes[31] = { +static const unsigned int capture_period_sizes[31] = { 384, 448, 512, 640, 384*2, 448*2, 512*2, 640*2, 384*4, 448*4, 512*4, 640*4, @@ -175,17 +175,17 @@ static unsigned int capture_period_sizes[31] = { 384*128,448*128,512*128 };
-static struct snd_pcm_hw_constraint_list hw_constraints_capture_period_sizes = { +static const struct snd_pcm_hw_constraint_list hw_constraints_capture_period_sizes = { .count = 31, .list = capture_period_sizes, .mask = 0 };
-static unsigned int capture_rates[8] = { +static const unsigned int capture_rates[8] = { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000 };
-static struct snd_pcm_hw_constraint_list hw_constraints_capture_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraints_capture_rates = { .count = 8, .list = capture_rates, .mask = 0

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/fm801.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index c47287d79306..2e402ece4c86 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c @@ -334,23 +334,23 @@ static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short return fm801_readw(chip, AC97_DATA); }
-static unsigned int rates[] = { +static const unsigned int rates[] = { 5500, 8000, 9600, 11025, 16000, 19200, 22050, 32000, 38400, 44100, 48000 };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0, };
-static unsigned int channels[] = { +static const unsigned int channels[] = { 2, 4, 6 };
-static struct snd_pcm_hw_constraint_list hw_constraints_channels = { +static const struct snd_pcm_hw_constraint_list hw_constraints_channels = { .count = ARRAY_SIZE(channels), .list = channels, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ens1370.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 09a63ef41ef2..f0d978e3b274 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -467,41 +467,41 @@ MODULE_DEVICE_TABLE(pci, snd_audiopci_ids); #define POLL_COUNT 0xa000
#ifdef CHIP1370 -static unsigned int snd_es1370_fixed_rates[] = +static const unsigned int snd_es1370_fixed_rates[] = {5512, 11025, 22050, 44100}; -static struct snd_pcm_hw_constraint_list snd_es1370_hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list snd_es1370_hw_constraints_rates = { .count = 4, .list = snd_es1370_fixed_rates, .mask = 0, }; -static struct snd_ratnum es1370_clock = { +static const struct snd_ratnum es1370_clock = { .num = ES_1370_SRCLOCK, .den_min = 29, .den_max = 353, .den_step = 1, }; -static struct snd_pcm_hw_constraint_ratnums snd_es1370_hw_constraints_clock = { +static const struct snd_pcm_hw_constraint_ratnums snd_es1370_hw_constraints_clock = { .nrats = 1, .rats = &es1370_clock, }; #else -static struct snd_ratden es1371_dac_clock = { +static const struct snd_ratden es1371_dac_clock = { .num_min = 3000 * (1 << 15), .num_max = 48000 * (1 << 15), .num_step = 3000, .den = 1 << 15, }; -static struct snd_pcm_hw_constraint_ratdens snd_es1371_hw_constraints_dac_clock = { +static const struct snd_pcm_hw_constraint_ratdens snd_es1371_hw_constraints_dac_clock = { .nrats = 1, .rats = &es1371_dac_clock, }; -static struct snd_ratnum es1371_adc_clock = { +static const struct snd_ratnum es1371_adc_clock = { .num = 48000 << 15, .den_min = 32768, .den_max = 393216, .den_step = 1, }; -static struct snd_pcm_hw_constraint_ratnums snd_es1371_hw_constraints_adc_clock = { +static const struct snd_pcm_hw_constraint_ratnums snd_es1371_hw_constraints_adc_clock = { .nrats = 1, .rats = &es1371_adc_clock, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/es1938.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index a544cd52f73a..069902a06f00 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c @@ -436,7 +436,7 @@ static void snd_es1938_reset_fifo(struct es1938 *chip) outb(0, SLSB_REG(chip, RESET)); }
-static struct snd_ratnum clocks[2] = { +static const struct snd_ratnum clocks[2] = { { .num = 793800, .den_min = 1, @@ -451,7 +451,7 @@ static struct snd_ratnum clocks[2] = { } };
-static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { +static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { .nrats = 2, .rats = clocks, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/hda/patch_hdmi.c | 10 +++++----- sound/pci/hda/patch_si3054.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 90e4ff87445e..0d7955eec201 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2782,21 +2782,21 @@ static int nvhdmi_7x_init_8ch(struct hda_codec *codec) return 0; }
-static unsigned int channels_2_6_8[] = { +static const unsigned int channels_2_6_8[] = { 2, 6, 8 };
-static unsigned int channels_2_8[] = { +static const unsigned int channels_2_8[] = { 2, 8 };
-static struct snd_pcm_hw_constraint_list hw_constraints_2_6_8_channels = { +static const struct snd_pcm_hw_constraint_list hw_constraints_2_6_8_channels = { .count = ARRAY_SIZE(channels_2_6_8), .list = channels_2_6_8, .mask = 0, };
-static struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = { +static const struct snd_pcm_hw_constraint_list hw_constraints_2_8_channels = { .count = ARRAY_SIZE(channels_2_8), .list = channels_2_8, .mask = 0, @@ -2807,7 +2807,7 @@ static int simple_playback_pcm_open(struct hda_pcm_stream *hinfo, struct snd_pcm_substream *substream) { struct hdmi_spec *spec = codec->spec; - struct snd_pcm_hw_constraint_list *hw_constraints_channels = NULL; + const struct snd_pcm_hw_constraint_list *hw_constraints_channels = NULL;
switch (codec->preset->vendor_id) { case 0x10de0002: diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c index ffda38c45509..f63acb1b965c 100644 --- a/sound/pci/hda/patch_si3054.c +++ b/sound/pci/hda/patch_si3054.c @@ -169,8 +169,8 @@ static int si3054_pcm_open(struct hda_pcm_stream *hinfo, struct hda_codec *codec, struct snd_pcm_substream *substream) { - static unsigned int rates[] = { 8000, 9600, 16000 }; - static struct snd_pcm_hw_constraint_list hw_constraints_rates = { + static const unsigned int rates[] = { 8000, 9600, 16000 }; + static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ice1712/ice1712.c | 4 ++-- sound/pci/ice1712/ice1712.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 6b650ab2a084..0e66afa403a3 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -932,10 +932,10 @@ static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device) * PCM code - professional part (multitrack) */
-static unsigned int rates[] = { 8000, 9600, 11025, 12000, 16000, 22050, 24000, +static const unsigned int rates[] = { 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000 };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0, diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h index 58f8f2ae758d..5cfba09c9761 100644 --- a/sound/pci/ice1712/ice1712.h +++ b/sound/pci/ice1712/ice1712.h @@ -348,7 +348,7 @@ struct snd_ice1712 {
struct mutex open_mutex; struct snd_pcm_substream *pcm_reserved[4]; - struct snd_pcm_hw_constraint_list *hw_rates; /* card-specific rate constraints */ + const struct snd_pcm_hw_constraint_list *hw_rates; /* card-specific rate constraints */
unsigned int akm_codecs; struct snd_akm4xxx *akm;

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/ice1712/ice1724.c | 8 ++++---- sound/pci/ice1712/juli.c | 6 +++--- sound/pci/ice1712/maya44.c | 4 ++-- sound/pci/ice1712/quartet.c | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 785188140f6b..057c2f394ea7 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -521,25 +521,25 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) * PCM code - professional part (multitrack) */
-static unsigned int rates[] = { +static const unsigned int rates[] = { 8000, 9600, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates_96 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates_96 = { .count = ARRAY_SIZE(rates) - 2, /* up to 96000 */ .list = rates, .mask = 0, };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates_48 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates_48 = { .count = ARRAY_SIZE(rates) - 5, /* up to 48000 */ .list = rates, .mask = 0, };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates_192 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates_192 = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0, diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 4f0213427152..5bb146703738 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -133,19 +133,19 @@ struct juli_spec { /* * Initial setup of the conversion array GPIO <-> rate */ -static unsigned int juli_rates[] = { +static const unsigned int juli_rates[] = { 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, };
-static unsigned int gpio_vals[] = { +static const unsigned int gpio_vals[] = { GPIO_RATE_16000, GPIO_RATE_22050, GPIO_RATE_24000, GPIO_RATE_32000, GPIO_RATE_44100, GPIO_RATE_48000, GPIO_RATE_64000, GPIO_RATE_88200, GPIO_RATE_96000, GPIO_RATE_176400, GPIO_RATE_192000, };
-static struct snd_pcm_hw_constraint_list juli_rates_info = { +static const struct snd_pcm_hw_constraint_list juli_rates_info = { .count = ARRAY_SIZE(juli_rates), .list = juli_rates, .mask = 0, diff --git a/sound/pci/ice1712/maya44.c b/sound/pci/ice1712/maya44.c index 7de25c4807fd..0e30419f6bbd 100644 --- a/sound/pci/ice1712/maya44.c +++ b/sound/pci/ice1712/maya44.c @@ -661,12 +661,12 @@ static void set_rate(struct snd_ice1712 *ice, unsigned int rate) * supported sample rates (to override the default one) */
-static unsigned int rates[] = { +static const unsigned int rates[] = { 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000 };
/* playback rates: 32..192 kHz */ -static struct snd_pcm_hw_constraint_list dac_rates = { +static const struct snd_pcm_hw_constraint_list dac_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0 diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index 7c387b04067e..f1b3732cc6d2 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c @@ -231,17 +231,17 @@ static char *get_binary(char *buffer, int value) /* * Initial setup of the conversion array GPIO <-> rate */ -static unsigned int qtet_rates[] = { +static const unsigned int qtet_rates[] = { 44100, 48000, 88200, 96000, 176400, 192000, };
-static unsigned int cks_vals[] = { +static const unsigned int cks_vals[] = { CPLD_CKS_44100HZ, CPLD_CKS_48000HZ, CPLD_CKS_88200HZ, CPLD_CKS_96000HZ, CPLD_CKS_176400HZ, CPLD_CKS_192000HZ, };
-static struct snd_pcm_hw_constraint_list qtet_rates_info = { +static const struct snd_pcm_hw_constraint_list qtet_rates_info = { .count = ARRAY_SIZE(qtet_rates), .list = qtet_rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/intel8x0.c | 12 ++++++------ sound/pci/intel8x0m.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 6d17b171c17b..a8d7092e93dd 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -1136,31 +1136,31 @@ static struct snd_pcm_hardware snd_intel8x0_stream = .fifo_size = 0, };
-static unsigned int channels4[] = { +static const unsigned int channels4[] = { 2, 4, };
-static struct snd_pcm_hw_constraint_list hw_constraints_channels4 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_channels4 = { .count = ARRAY_SIZE(channels4), .list = channels4, .mask = 0, };
-static unsigned int channels6[] = { +static const unsigned int channels6[] = { 2, 4, 6, };
-static struct snd_pcm_hw_constraint_list hw_constraints_channels6 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_channels6 = { .count = ARRAY_SIZE(channels6), .list = channels6, .mask = 0, };
-static unsigned int channels8[] = { +static const unsigned int channels8[] = { 2, 4, 6, 8, };
-static struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { +static const struct snd_pcm_hw_constraint_list hw_constraints_channels8 = { .count = ARRAY_SIZE(channels8), .list = channels8, .mask = 0, diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 1bc98c867133..18ff668ce7a5 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -635,8 +635,8 @@ static struct snd_pcm_hardware snd_intel8x0m_stream =
static int snd_intel8x0m_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) { - static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; - static struct snd_pcm_hw_constraint_list hw_constraints_rates = { + static const unsigned int rates[] = { 8000, 9600, 12000, 16000 }; + static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/nm256/nm256.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 63f0985dae27..0ef8054c3936 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c @@ -398,10 +398,10 @@ snd_nm256_load_coefficient(struct nm256 *chip, int stream, int number)
/* The actual rates supported by the card. */ -static unsigned int samplerates[8] = { +static const unsigned int samplerates[8] = { 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, }; -static struct snd_pcm_hw_constraint_list constraints_rates = { +static const struct snd_pcm_hw_constraint_list constraints_rates = { .count = ARRAY_SIZE(samplerates), .list = samplerates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme32.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 67d48c8869e9..e4cdef94e4a2 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -836,10 +836,9 @@ static irqreturn_t snd_rme32_interrupt(int irq, void *dev_id) return IRQ_HANDLED; }
-static unsigned int period_bytes[] = { RME32_BLOCK_SIZE }; +static const unsigned int period_bytes[] = { RME32_BLOCK_SIZE };
- -static struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = { +static const struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = { .count = ARRAY_SIZE(period_bytes), .list = period_bytes, .mask = 0

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme96.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 24f1349a8e1b..2e19ba55e754 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -1163,9 +1163,9 @@ snd_rme96_interrupt(int irq, return IRQ_HANDLED; }
-static unsigned int period_bytes[] = { RME96_SMALL_BLOCK_SIZE, RME96_LARGE_BLOCK_SIZE }; +static const unsigned int period_bytes[] = { RME96_SMALL_BLOCK_SIZE, RME96_LARGE_BLOCK_SIZE };
-static struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = { +static const struct snd_pcm_hw_constraint_list hw_constraints_period_bytes = { .count = ARRAY_SIZE(period_bytes), .list = period_bytes, .mask = 0

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdsp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index b00009644e0e..fe36d44d16c6 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -4270,17 +4270,17 @@ static struct snd_pcm_hardware snd_hdsp_capture_subinfo = .fifo_size = 0 };
-static unsigned int hdsp_period_sizes[] = { 64, 128, 256, 512, 1024, 2048, 4096, 8192 }; +static const unsigned int hdsp_period_sizes[] = { 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
-static struct snd_pcm_hw_constraint_list hdsp_hw_constraints_period_sizes = { +static const struct snd_pcm_hw_constraint_list hdsp_hw_constraints_period_sizes = { .count = ARRAY_SIZE(hdsp_period_sizes), .list = hdsp_period_sizes, .mask = 0 };
-static unsigned int hdsp_9632_sample_rates[] = { 32000, 44100, 48000, 64000, 88200, 96000, 128000, 176400, 192000 }; +static const unsigned int hdsp_9632_sample_rates[] = { 32000, 44100, 48000, 64000, 88200, 96000, 128000, 176400, 192000 };
-static struct snd_pcm_hw_constraint_list hdsp_hw_constraints_9632_sample_rates = { +static const struct snd_pcm_hw_constraint_list hdsp_hw_constraints_9632_sample_rates = { .count = ARRAY_SIZE(hdsp_9632_sample_rates), .list = hdsp_9632_sample_rates, .mask = 0

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/hdspm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index c48acdb0e186..254c3d040118 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6040,11 +6040,11 @@ static int snd_hdspm_hw_rule_out_channels(struct snd_pcm_hw_params *params, }
-static unsigned int hdspm_aes32_sample_rates[] = { +static const unsigned int hdspm_aes32_sample_rates[] = { 32000, 44100, 48000, 64000, 88200, 96000, 128000, 176400, 192000 };
-static struct snd_pcm_hw_constraint_list +static const struct snd_pcm_hw_constraint_list hdspm_hw_constraints_aes32_sample_rates = { .count = ARRAY_SIZE(hdspm_aes32_sample_rates), .list = hdspm_aes32_sample_rates,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/rme9652/rme9652.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 59684bf5cac0..150d08898db8 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -2228,9 +2228,9 @@ static struct snd_pcm_hardware snd_rme9652_capture_subinfo = .fifo_size = 0, };
-static unsigned int period_sizes[] = { 64, 128, 256, 512, 1024, 2048, 4096, 8192 }; +static const unsigned int period_sizes[] = { 64, 128, 256, 512, 1024, 2048, 4096, 8192 };
-static struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = { +static const struct snd_pcm_hw_constraint_list hw_constraints_period_sizes = { .count = ARRAY_SIZE(period_sizes), .list = period_sizes, .mask = 0

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/sonicvibes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 8e3d4ec39c35..784d762f18a7 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -248,13 +248,13 @@ static const struct pci_device_id snd_sonic_ids[] = {
MODULE_DEVICE_TABLE(pci, snd_sonic_ids);
-static struct snd_ratden sonicvibes_adc_clock = { +static const struct snd_ratden sonicvibes_adc_clock = { .num_min = 4000 * 65536, .num_max = 48000UL * 65536, .num_step = 1, .den = 65536, }; -static struct snd_pcm_hw_constraint_ratdens snd_sonicvibes_hw_constraints_adc_clock = { +static const struct snd_pcm_hw_constraint_ratdens snd_sonicvibes_hw_constraints_adc_clock = { .nrats = 1, .rats = &sonicvibes_adc_clock, };

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/pci/via82xx.c | 4 ++-- sound/pci/via82xx_modem.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index b6c84d15b10b..c767b8664359 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -1286,10 +1286,10 @@ static int snd_via8233_multi_open(struct snd_pcm_substream *substream) /* channels constraint for VIA8233A * 3 and 5 channels are not supported */ - static unsigned int channels[] = { + static const unsigned int channels[] = { 1, 2, 4, 6 }; - static struct snd_pcm_hw_constraint_list hw_constraints_channels = { + static const struct snd_pcm_hw_constraint_list hw_constraints_channels = { .count = ARRAY_SIZE(channels), .list = channels, .mask = 0, diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 2f6d40f10618..55f79b2599e7 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -744,8 +744,8 @@ static int snd_via82xx_modem_pcm_open(struct via82xx_modem *chip, struct viadev { struct snd_pcm_runtime *runtime = substream->runtime; int err; - static unsigned int rates[] = { 8000, 9600, 12000, 16000 }; - static struct snd_pcm_hw_constraint_list hw_constraints_rates = { + static const unsigned int rates[] = { 8000, 9600, 12000, 16000 }; + static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, .mask = 0,

snd_pcm_hw_constraint_list(), *_ratnums() and *_ratdens() receive the const pointers. Constify the corresponding static objects for better hardening.
Signed-off-by: Takashi Iwai tiwai@suse.de --- sound/sparc/cs4231.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c index 30bdc971883b..3d7d425fbd24 100644 --- a/sound/sparc/cs4231.c +++ b/sound/sparc/cs4231.c @@ -200,12 +200,12 @@ static unsigned char freq_bits[14] = { /* 48000 */ 0x0C | CS4231_XTAL1 };
-static unsigned int rates[14] = { +static const unsigned int rates[14] = { 5510, 6620, 8000, 9600, 11025, 16000, 18900, 22050, 27042, 32000, 33075, 37800, 44100, 48000 };
-static struct snd_pcm_hw_constraint_list hw_constraints_rates = { +static const struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = ARRAY_SIZE(rates), .list = rates, };
participants (1)
-
Takashi Iwai