Fixes for sparse warnings and other misc bugs
cover Fixes for sparse warnings and other misc bugs
Hi,
this is a series of patches to correct bugs spotted by sparse and manual lookups, applied in a wide range of drivers.
Takashi
===
Takashi Iwai (12):
ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
ALSA: msnd: Add missing __iomem annotations
ALSA: msnd: Fix the default sample sizes
ALSA: hda/ca0132 - Use NULL instead of 0
ALSA: msnd: Use NULL instead of 0
ALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t
ALSA: opl3: Declare common variables properly
ALSA: usb-audio: Declare the common variable in header file
ALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()
ALSA: pcm: Use standard lower_32_bits() and upper_32_bits()
ALSA: korg1212: Add __force annotation to cast in user-copy callbacks
ALSA: emu10k1: Fix missing __force annotation for user/kernel pointer
cast
include/sound/pcm.h | 4 ++-- sound/core/oss/pcm_plugin.c | 8 ++++---- sound/drivers/opl3/opl3_drums.c | 2 -- sound/drivers/opl3/opl3_lib.c | 3 +-- sound/drivers/opl3/opl3_midi.c | 4 ---- sound/drivers/opl3/opl3_oss.c | 2 -- sound/drivers/opl3/opl3_synth.c | 1 + sound/drivers/opl3/opl3_voice.h | 4 ++++ sound/isa/msnd/msnd.c | 18 +++++++++--------- sound/isa/msnd/msnd.h | 2 +- sound/isa/msnd/msnd_midi.c | 2 +- sound/isa/msnd/msnd_pinnacle.c | 8 ++++---- sound/pci/emu10k1/emufx.c | 24 ++++++++++++------------ sound/pci/hda/hda_codec.c | 4 ++-- sound/pci/hda/patch_ca0132.c | 3 +-- sound/pci/korg1212/korg1212.c | 4 ++-- sound/usb/mixer.h | 2 ++ sound/usb/mixer_quirks.c | 2 -- sound/usb/quirks-table.h | 3 ++- 19 files changed, 48 insertions(+), 52 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/12 ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC() for expanding idVendor and idProduct fields. However, the latter macro adds also match_flags and bInterfaceClass, which are different from the values AU0828_DEVICE() macro sets after that.
For fixing them, just expand idVendor and idProduct fields manually in AU0828_DEVICE().
This fixes sparse warnings like:
sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice
--- sound/usb/quirks-table.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/quirks-table.h +2 -1
@@ -2875,7 +2875,8 @@ YAMAHA_DEVICE(0x7010, "UB99"),*/ #define AU0828_DEVICE (vid, pid, vname, pname) { \ - USB_DEVICE_VENDOR_SPEC(vid, pid), \ + .idVendor = vid, \ + .idProduct = pid, \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ USB_DEVICE_ID_MATCH_INT_CLASS | \ USB_DEVICE_ID_MATCH_INT_SUBCLASS, \
Signature · 1 line
2.18.0
PATCH 2/12 ALSA: msnd: Add missing __iomem annotations
In reply to Takashi IwaiThe io-mapped buffers used in msnd drivers need __iomem annotations.
This fixes sparse warnings like:
sound/isa/msnd/msnd_pinnacle.c:172:45: warning: incorrect type in initializer (different address spaces)
--- sound/isa/msnd/msnd.c | 18 +++++++++--------- sound/isa/msnd/msnd.h | 2 +- sound/isa/msnd/msnd_midi.c | 2 +- sound/isa/msnd/msnd_pinnacle.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-)
sound/isa/msnd/msnd.c +9 -9
@@ -54,7 +54,7 @@#define LOGNAME "msnd" -void snd_msnd_init_queue (void *base,int start,int size) +void snd_msnd_init_queue (void __iomem *base,int start,int size) {writew (PCTODSP_BASED (start), base + JQS_wStart);writew (PCTODSP_OFFSET (size) -1 , base + JQS_wSize);
@@ -270,7 +270,7 @@ int snd_msnd_DARQ(struct snd_msnd *chip, int bank)udelay (1 );if (chip->capturePeriods ==2 ) { -void *pDAQ = chip->mappedbase +DARQ_DATA_BUFF + +void __iomem *pDAQ = chip->mappedbase +DARQ_DATA_BUFF + bank * DAQDS__size + DAQDS_wStart;unsigned short offset =0x3000 + chip->capturePeriodBytes;
@@ -309,7 +309,7 @@ int snd_msnd_DAPQ(struct snd_msnd *chip, int start) {u16 DAPQ_tail;int protect = start, nbanks =0 ; -void *DAQD ; +void __iomem *DAQD ;static int play_banks_submitted;/* unsigned long flags; spin_lock_irqsave(&chip->lock, flags); not necessary */
@@ -370,7 +370,7 @@ static void snd_msnd_play_reset_queue(struct snd_msnd *chip, unsigned int pcm_count) {int n; -void *pDAQ = chip->mappedbase +DAPQ_DATA_BUFF ; +void __iomem *pDAQ = chip->mappedbase +DAPQ_DATA_BUFF ; chip->last_playbank =-1 ; chip->playLimit = pcm_count * (pcm_periods -1 );
@@ -398,7 +398,7 @@ static void snd_msnd_capture_reset_queue(struct snd_msnd *chip, unsigned int pcm_count) {int n; -void *pDAQ; +void __iomem *pDAQ;/* unsigned long flags; */ /* snd_msnd_init_queue(chip->DARQ, DARQ_DATA_BUFF, DARQ_BUFF_SIZE); */
@@ -485,7 +485,7 @@ static int snd_msnd_playback_open(struct snd_pcm_substream *substream)clear_bit (F_WRITING , &chip->flags);snd_msnd_enable_irq (chip); - runtime->dma_area = chip->mappedbase; + runtime->dma_area = (__force void *)chip->mappedbase; runtime->dma_bytes =0x3000 ; chip->playback_substream = substream;
@@ -508,7 +508,7 @@ static int snd_msnd_playback_hw_params(struct snd_pcm_substream *substream, {int i;struct snd_msnd *chip =snd_pcm_substream_chip (substream); -void *pDAQ = chip->mappedbase +DAPQ_DATA_BUFF ; +void __iomem *pDAQ = chip->mappedbase +DAPQ_DATA_BUFF ; chip->play_sample_size =snd_pcm_format_width (params_format (params)); chip->play_channels =params_channels (params);
@@ -589,7 +589,7 @@ static int snd_msnd_capture_open(struct snd_pcm_substream *substream)set_bit (F_AUDIO_READ_INUSE , &chip->flags);snd_msnd_enable_irq (chip); - runtime->dma_area = chip->mappedbase +0x3000 ; + runtime->dma_area = (__force void *)chip->mappedbase +0x3000 ; runtime->dma_bytes =0x3000 ;memset (runtime->dma_area,0 , runtime->dma_bytes); chip->capture_substream = substream;
@@ -654,7 +654,7 @@ static int snd_msnd_capture_hw_params(struct snd_pcm_substream *substream, {int i;struct snd_msnd *chip =snd_pcm_substream_chip (substream); -void *pDAQ = chip->mappedbase +DARQ_DATA_BUFF ; +void __iomem *pDAQ = chip->mappedbase +DARQ_DATA_BUFF ; chip->capture_sample_size =snd_pcm_format_width (params_format (params)); chip->capture_channels =params_channels (params);
sound/isa/msnd/msnd.h +1 -1
@@ -283,7 +283,7 @@ struct snd_msnd { }; -void snd_msnd_init_queue (void *base,int start,int size); +void snd_msnd_init_queue (void __iomem *base,int start,int size);int snd_msnd_send_dsp_cmd (struct snd_msnd *chip,u8 cmd); int snd_msnd_send_word(struct snd_msnd *chip,
sound/isa/msnd/msnd_midi.c +1 -1
@@ -119,7 +119,7 @@ void snd_msndmidi_input_read(void *mpuv) {unsigned long flags;struct snd_msndmidi *mpu = mpuv; -void *pwMIDQData = mpu->dev->mappedbase +MIDQ_DATA_BUFF ; +void __iomem *pwMIDQData = mpu->dev->mappedbase +MIDQ_DATA_BUFF ;u16 head, tail, size;spin_lock_irqsave (&mpu->input_lock, flags);
sound/isa/msnd/msnd_pinnacle.c +1 -1
@@ -169,7 +169,7 @@ static void snd_msnd_eval_dsp_msg(struct snd_msnd *chip, u16 wMessage)static irqreturn_t snd_msnd_interrupt (int irq,void *dev_id) {struct snd_msnd *chip = dev_id; -void *pwDSPQData = chip->mappedbase +DSPQ_DATA_BUFF ; +void __iomem *pwDSPQData = chip->mappedbase +DSPQ_DATA_BUFF ;u16 head, tail, size;/* Send ack to DSP */
Signature · 1 line
2.18.0
PATCH 3/12 ALSA: msnd: Fix the default sample sizes
In reply to Takashi IwaiThe default sample sizes set by msnd driver are bogus; it sets ALSA PCM format, not the actual bit width.
--- sound/isa/msnd/msnd_pinnacle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/isa/msnd/msnd_pinnacle.c +2 -2
@@ -82,10 +82,10 @@static void set_default_audio_parameters (struct snd_msnd *chip) { - chip->play_sample_size =DEFSAMPLESIZE ; + chip->play_sample_size =snd_pcm_format_width (DEFSAMPLESIZE ); chip->play_sample_rate =DEFSAMPLERATE ; chip->play_channels =DEFCHANNELS ; - chip->capture_sample_size =DEFSAMPLESIZE ; + chip->capture_sample_size =snd_pcm_format_width (DEFSAMPLESIZE ); chip->capture_sample_rate =DEFSAMPLERATE ; chip->capture_channels =DEFCHANNELS ; }
Signature · 1 line
2.18.0
PATCH 4/12 ALSA: hda/ca0132 - Use NULL instead of 0
In reply to Takashi IwaiUse NULL for initializing the snd_kcontrol_new.tlv field, instead of 0, as warned by sparse:
sound/pci/hda/patch_ca0132.c:5519:22: warning: Using plain integer as NULL pointer
Also, the driver does the same initialization twice, once for knew.tlv.c and another for knew.tlv.p while both point to the same address (these are union). Drop the latter superfluous one.
--- sound/pci/hda/patch_ca0132.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/pci/hda/patch_ca0132.c +1 -2
@@ -5516,8 +5516,7 @@ static int ca0132_alt_add_effect_slider(struct hda_codec *codec, hda_nid_t nid,sprintf (namestr,"FX: %s %s Volume" , pfx, dirstr[dir]); - knew.tlv.c =0 ; - knew.tlv.p =0 ; + knew.tlv.c =NULL ;switch (nid) {case XBASS_XOVER :
Signature · 1 line
2.18.0
PATCH 5/12 ALSA: msnd: Use NULL instead of 0
In reply to Takashi IwaiFix a sparse warning:
sound/isa/msnd/msnd_pinnacle.c:813:1: warning: Using plain integer as NULL pointer
--- sound/isa/msnd/msnd_pinnacle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/isa/msnd/msnd_pinnacle.c +1 -1
@@ -810,7 +810,7 @@ module_param(calibrate_signal, int, 0444);#ifndef MSND_CLASSIC module_param_array (digital, int,NULL ,0444 );module_param_hw_array (cfg, long, ioport,NULL ,0444 ); -module_param_array (reset, int,0 ,0444 ); +module_param_array (reset, int,NULL ,0444 );module_param_hw_array (mpu_io, long, ioport,NULL ,0444 );module_param_hw_array (mpu_irq, int, irq,NULL ,0444 );module_param_hw_array (ide_io0, long, ioport,NULL ,0444 );
Signature · 1 line
2.18.0
PATCH 6/12 ALSA: hda - Fix a sparse warning about snd_ctl_elem_iface_t
In reply to Takashi IwaiThe knew->iface field is in snd_ctl_elem_iface_t, which is with __bitwise, hence it can't be converted implicitly from integer. Give an explicit cast for the invalid type.
Spotted by sparse:
sound/pci/hda/hda_codec.c:3280:25: warning: restricted snd_ctl_elem_iface_t degrades to integer
--- sound/pci/hda/hda_codec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_codec.c +2 -2
@@ -3277,8 +3277,8 @@ int snd_hda_add_new_ctls(struct hda_codec *codec,for (; knew->name; knew++) {struct snd_kcontrol *kctl;int addr =0 , idx =0 ; -if (knew->iface ==-1 )/* skip this codec private value */ -continue ; +if (knew->iface == (__force snd_ctl_elem_iface_t)-1 ) +continue ;/* skip this codec private value */ for (;;) { kctl =snd_ctl_new1 (knew, codec);if (!kctl)
Signature · 1 line
2.18.0
PATCH 7/12 ALSA: opl3: Declare common variables properly
In reply to Takashi IwaiMove the declarations of common variables into opl3_voice.h instead of declaring at each file multiple times, which was error-prone.
This fixes sparse warnings like:
sound/drivers/opl3/opl3_synth.c:51:6: warning: symbol 'snd_opl3_regmap' was not declared. Should it be static?
--- sound/drivers/opl3/opl3_drums.c | 2 -- sound/drivers/opl3/opl3_lib.c | 3 +-- sound/drivers/opl3/opl3_midi.c | 4 ---- sound/drivers/opl3/opl3_oss.c | 2 -- sound/drivers/opl3/opl3_synth.c | 1 + sound/drivers/opl3/opl3_voice.h | 4 ++++ 6 files changed, 6 insertions(+), 10 deletions(-)
sound/drivers/opl3/opl3_drums.c +0 -2
@@ -21,8 +21,6 @@#include "opl3_voice.h" -extern char snd_opl3_regmap[MAX_OPL2_VOICES ][4 ]; -static char snd_opl3_drum_table[47 ] = {OPL3_BASSDRUM_ON ,OPL3_BASSDRUM_ON ,OPL3_HIHAT_ON ,/* 35 - 37 */
sound/drivers/opl3/opl3_lib.c +1 -2
@@ -31,13 +31,12 @@#include <linux/slab.h> #include <linux/ioport.h> #include <sound/minors.h> +#include "opl3_voice.h" MODULE_AUTHOR ("Jaroslav Kysela <[email protected]>, Hannu Savolainen 1993-1996, Rob Hooft" );MODULE_DESCRIPTION ("Routines for control of AdLib FM cards (OPL2/OPL3/OPL4 chips)" );MODULE_LICENSE ("GPL" ); -extern char snd_opl3_regmap[MAX_OPL2_VOICES ][4 ]; -static void snd_opl2_command (struct snd_opl3 * opl3,unsigned short cmd,unsigned char val) {unsigned long flags;
sound/drivers/opl3/opl3_midi.c +0 -4
@@ -25,10 +25,6 @@#include "opl3_voice.h" #include <sound/asoundef.h> -extern char snd_opl3_regmap[MAX_OPL2_VOICES ][4 ]; - -extern bool use_internal_drums; -static void snd_opl3_note_off_unsafe (void *p,int note,int vel,struct snd_midi_channel *chan);/*
sound/drivers/opl3/opl3_oss.c +0 -2
@@ -29,8 +29,6 @@ static int snd_opl3_reset_seq_oss(struct snd_seq_oss_arg *arg);/* operators */ -extern struct snd_midi_op opl3_ops; -static struct snd_seq_oss_callback oss_callback = { .owner =THIS_MODULE , .open = snd_opl3_open_seq_oss,
sound/drivers/opl3/opl3_synth.c +1 -0
@@ -24,6 +24,7 @@#include <linux/nospec.h> #include <sound/opl3.h> #include <sound/asound_fm.h> +#include "opl3_voice.h" #if IS_ENABLED (CONFIG_SND_SEQUENCER )#define OPL3_SUPPORT_SYNTH
sound/drivers/opl3/opl3_voice.h +4 -0
@@ -52,4 +52,8 @@ void snd_opl3_free_seq_oss(struct snd_opl3 *opl3);#define snd_opl3_free_seq_oss (opl3)/* NOP */ #endif +extern char snd_opl3_regmap[MAX_OPL2_VOICES ][4 ]; +extern bool use_internal_drums; +extern struct snd_midi_op opl3_ops; +#endif
Signature · 1 line
2.18.0
PATCH 8/12 ALSA: usb-audio: Declare the common variable in header file
In reply to Takashi IwaiDeclare snd_usb_feature_unit_ctl properly in mixer.h. Otherwise it's error-prone.
This fixes the sparse warning:
sound/usb/mixer.c:1464:25: warning: symbol 'snd_usb_feature_unit_ctl' was not declared. Should it be static?
--- sound/usb/mixer.h | 2 ++ sound/usb/mixer_quirks.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/usb/mixer.h +2 -0
@@ -109,4 +109,6 @@ int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval,extern void snd_usb_mixer_elem_free (struct snd_kcontrol *kctl); +extern struct snd_kcontrol_new *snd_usb_feature_unit_ctl; +#endif /* __USBMIXER_H */
sound/usb/mixer_quirks.c +0 -2
@@ -47,8 +47,6 @@#include "mixer_us16x08.h" #include "helper.h" -extern struct snd_kcontrol_new *snd_usb_feature_unit_ctl; -struct std_mono_table {unsigned int unitid, control, cmask;int val_type;
Signature · 1 line
2.18.0
PATCH 9/12 ALSA: pcm: Add __force to cast in snd_pcm_lib_read/write()
In reply to Takashi IwaiThe snd_pcm_lib_read() and snd_pcm_lib_write() inline functions have the explicit cast from a user pointer to a kernel pointer, but they lacks of __force prefix.
This fixes sparse warnings like:
./include/sound/pcm.h:1093:47: warning: cast removes address space of expression
--- include/sound/pcm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/sound/pcm.h +2 -2
@@ -1090,14 +1090,14 @@ static inline snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, const void __user *buf, snd_pcm_uframes_t frames) { - return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames, false); + return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); }static inline snd_pcm_sframes_t snd_pcm_lib_read (struct snd_pcm_substream *substream,void __user *buf,snd_pcm_uframes_t frames) { -return __snd_pcm_lib_xfer (substream, (void *)buf, true, frames, false); +return __snd_pcm_lib_xfer (substream, (void __force *)buf, true, frames, false); } static inline snd_pcm_sframes_t
Signature · 1 line
2.18.0
PATCH 10/12 ALSA: pcm: Use standard lower_32_bits() and upper_32_bits()
In reply to Takashi IwaiInstead of open codes, use the standard macros for obtaining the lower and upper 32bit values.
--- sound/core/oss/pcm_plugin.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/core/oss/pcm_plugin.c +4 -4
@@ -281,10 +281,10 @@ static int snd_pcm_plug_formats(const struct snd_mask *mask, SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE);snd_mask_set (&formats, (__force int )SNDRV_PCM_FORMAT_MU_LAW ); -if (formats.bits[0 ] & (u32 )linfmts) - formats.bits[0 ] |= (u32 )linfmts; -if (formats.bits[1 ] & (u32)(linfmts >>32 )) - formats.bits[1 ] |= (u32)(linfmts >>32 ); +if (formats.bits[0 ] &lower_32_bits (linfmts)) + formats.bits[0 ] |=lower_32_bits (linfmts); +if (formats.bits[1 ] &upper_32_bits (linfmts)) + formats.bits[1 ] |=upper_32_bits (linfmts);return snd_mask_test (&formats, (__force int )format); }
Signature · 1 line
2.18.0
PATCH 11/12 ALSA: korg1212: Add __force annotation to cast in user-copy callbacks
In reply to Takashi IwaiThe user-copy callbacks in korg1212 driver contain the explicit cast from a user pointer to a kernel pointer, but they missed __force prefix. It's mandatory for converting between them.
Spotted by sparse, a warning like:
sound/pci/korg1212/korg1212.c:1329:33: warning: cast removes address space of expression
--- sound/pci/korg1212/korg1212.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/korg1212/korg1212.c +2 -2
@@ -1326,7 +1326,7 @@ static int snd_korg1212_copy_to(struct snd_pcm_substream *substream, }#endif if (in_kernel) -memcpy ((void *)dst, src, size); +memcpy ((__force void *)dst, src, size);else if (copy_to_user (dst, src, size))return -EFAULT ; src++;
@@ -1365,7 +1365,7 @@ static int snd_korg1212_copy_from(struct snd_pcm_substream *substream, }#endif if (in_kernel) -memcpy ((void *)dst, src, size); +memcpy (dst, (__force void *)src, size);else if (copy_from_user (dst, src, size))return -EFAULT ; dst++;
Signature · 1 line
2.18.0
PATCH 12/12 ALSA: emu10k1: Fix missing __force annotation for user/kernel pointer cast
In reply to Takashi IwaiThe cast between user-space and kernel-space needs an explicit __force prefix, but it's missing in many places in emu10k1 driver code.
Spotted by sparse as a warning like:
sound/pci/emu10k1/emufx.c:529:33: warning: cast removes address space of expression
--- sound/pci/emu10k1/emufx.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
sound/pci/emu10k1/emufx.c +12 -12
@@ -526,7 +526,7 @@ static int snd_emu10k1_gpr_poke(struct snd_emu10k1 *emu,if (!test_bit (gpr, icode->gpr_valid))continue ;if (in_kernel) - val = *(u32 *)&icode->gpr_map[gpr]; + val = *(__force u32 *)&icode->gpr_map[gpr];else if (get_user (val, &icode->gpr_map[gpr]))return -EFAULT ;snd_emu10k1_ptr_write (emu, emu->gpr_base + gpr,0 , val);
@@ -560,8 +560,8 @@ static int snd_emu10k1_tram_poke(struct snd_emu10k1 *emu,if (!test_bit (tram, icode->tram_valid))continue ;if (in_kernel) { - val = *(u32 *)&icode->tram_data_map[tram]; - addr = *(u32 *)&icode->tram_addr_map[tram]; + val = *(__force u32 *)&icode->tram_data_map[tram]; + addr = *(__force u32 *)&icode->tram_addr_map[tram]; }else {if (get_user (val, &icode->tram_data_map[tram]) ||get_user (addr, &icode->tram_addr_map[tram]))
@@ -611,8 +611,8 @@ static int snd_emu10k1_code_poke(struct snd_emu10k1 *emu,if (!test_bit (pc /2 , icode->code_valid))continue ;if (in_kernel) { - lo = *(u32 *)&icode->code[pc +0 ]; - hi = *(u32 *)&icode->code[pc +1 ]; + lo = *(__force u32 *)&icode->code[pc +0 ]; + hi = *(__force u32 *)&icode->code[pc +1 ]; }else {if (get_user (lo, &icode->code[pc +0 ]) ||get_user (hi, &icode->code[pc +1 ]))
@@ -666,7 +666,7 @@ static unsigned int *copy_tlv(const unsigned int __user *_tlv, bool in_kernel)if (!_tlv)return NULL ;if (in_kernel) -memcpy (data, (void *)_tlv,sizeof (data)); +memcpy (data, (__force void *)_tlv,sizeof (data));else if (copy_from_user (data, _tlv,sizeof (data)))return NULL ;if (data[1 ] >=MAX_TLV_SIZE )
@@ -676,7 +676,7 @@ static unsigned int *copy_tlv(const unsigned int __user *_tlv, bool in_kernel)return NULL ;memcpy (tlv, data,sizeof (data));if (in_kernel) { -memcpy (tlv +2 , (void *)(_tlv +2 ), data[1 ]); +memcpy (tlv +2 , (__force void *)(_tlv +2 ), data[1 ]); }else if (copy_from_user (tlv +2 , _tlv +2 , data[1 ])) {kfree (tlv);return NULL ;
@@ -693,7 +693,7 @@ static int copy_gctl(struct snd_emu10k1 *emu,if (emu->support_tlv) {if (in_kernel) -memcpy (gctl, (void *)&_gctl[idx],sizeof (*gctl)); +memcpy (gctl, (__force void *)&_gctl[idx],sizeof (*gctl));else if (copy_from_user (gctl, &_gctl[idx],sizeof (*gctl)))return -EFAULT ;return 0 ;
@@ -701,7 +701,7 @@ static int copy_gctl(struct snd_emu10k1 *emu, octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl;if (in_kernel) -memcpy (gctl, (void *)&octl[idx],sizeof (*octl)); +memcpy (gctl, (__force void *)&octl[idx],sizeof (*octl));else if (copy_from_user (gctl, &octl[idx],sizeof (*octl)))return -EFAULT ; gctl->tlv =NULL ;
@@ -735,7 +735,7 @@ static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,for (i =0 , _id = icode->gpr_del_controls; i < icode->gpr_del_control_count; i++, _id++) {if (in_kernel) - id = *(struct snd_ctl_elem_id *)_id; + id = *(__force struct snd_ctl_elem_id *)_id;else if (copy_from_user (&id, _id,sizeof (id)))return -EFAULT ;if (snd_emu10k1_look_for_ctl (emu, &id) ==NULL )
@@ -833,7 +833,7 @@ static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu, knew.device = gctl->id.device; knew.subdevice = gctl->id.subdevice; knew.info = snd_emu10k1_gpr_ctl_info; - knew.tlv.p =copy_tlv (gctl->tlv, in_kernel); + knew.tlv.p =copy_tlv ((__force const unsigned int __user *)gctl->tlv, in_kernel);if (knew.tlv.p) knew.access =SNDRV_CTL_ELEM_ACCESS_READWRITE |SNDRV_CTL_ELEM_ACCESS_TLV_READ ;
@@ -897,7 +897,7 @@ static int snd_emu10k1_del_controls(struct snd_emu10k1 *emu,for (i =0 , _id = icode->gpr_del_controls; i < icode->gpr_del_control_count; i++, _id++) {if (in_kernel) - id = *(struct snd_ctl_elem_id *)_id; + id = *(__force struct snd_ctl_elem_id *)_id;else if (copy_from_user (&id, _id,sizeof (id)))return -EFAULT ;down_write (&card->controls_rwsem);
Signature · 1 line
2.18.0