|
@@ -60,18 +60,18 @@ MODULE_FIRMWARE("sb16/ima_adpcm_capture.csp");
|
|
|
* RIFF data format
|
|
|
*/
|
|
|
struct riff_header {
|
|
|
- __u32 name;
|
|
|
- __u32 len;
|
|
|
+ __le32 name;
|
|
|
+ __le32 len;
|
|
|
};
|
|
|
|
|
|
struct desc_header {
|
|
|
struct riff_header info;
|
|
|
- __u16 func_nr;
|
|
|
- __u16 VOC_type;
|
|
|
- __u16 flags_play_rec;
|
|
|
- __u16 flags_16bit_8bit;
|
|
|
- __u16 flags_stereo_mono;
|
|
|
- __u16 flags_rates;
|
|
|
+ __le16 func_nr;
|
|
|
+ __le16 VOC_type;
|
|
|
+ __le16 flags_play_rec;
|
|
|
+ __le16 flags_16bit_8bit;
|
|
|
+ __le16 flags_stereo_mono;
|
|
|
+ __le16 flags_rates;
|
|
|
};
|
|
|
|
|
|
/*
|
|
@@ -314,7 +314,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
|
|
|
unsigned short func_nr = 0;
|
|
|
|
|
|
struct riff_header file_h, item_h, code_h;
|
|
|
- __u32 item_type;
|
|
|
+ __le32 item_type;
|
|
|
struct desc_header funcdesc_h;
|
|
|
|
|
|
unsigned long flags;
|
|
@@ -326,7 +326,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
|
|
|
|
|
|
if (copy_from_user(&file_h, data_ptr, sizeof(file_h)))
|
|
|
return -EFAULT;
|
|
|
- if ((file_h.name != RIFF_HEADER) ||
|
|
|
+ if ((le32_to_cpu(file_h.name) != RIFF_HEADER) ||
|
|
|
(le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) {
|
|
|
snd_printd("%s: Invalid RIFF header\n", __func__);
|
|
|
return -EINVAL;
|
|
@@ -336,7 +336,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
|
|
|
|
|
|
if (copy_from_user(&item_type, data_ptr, sizeof(item_type)))
|
|
|
return -EFAULT;
|
|
|
- if (item_type != CSP__HEADER) {
|
|
|
+ if (le32_to_cpu(item_type) != CSP__HEADER) {
|
|
|
snd_printd("%s: Invalid RIFF file type\n", __func__);
|
|
|
return -EINVAL;
|
|
|
}
|
|
@@ -346,12 +346,12 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
|
|
|
if (copy_from_user(&item_h, data_ptr, sizeof(item_h)))
|
|
|
return -EFAULT;
|
|
|
data_ptr += sizeof(item_h);
|
|
|
- if (item_h.name != LIST_HEADER)
|
|
|
+ if (le32_to_cpu(item_h.name) != LIST_HEADER)
|
|
|
continue;
|
|
|
|
|
|
if (copy_from_user(&item_type, data_ptr, sizeof(item_type)))
|
|
|
return -EFAULT;
|
|
|
- switch (item_type) {
|
|
|
+ switch (le32_to_cpu(item_type)) {
|
|
|
case FUNC_HEADER:
|
|
|
if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h)))
|
|
|
return -EFAULT;
|
|
@@ -378,7 +378,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
|
|
|
return -EFAULT;
|
|
|
|
|
|
/* init microcode blocks */
|
|
|
- if (code_h.name != INIT_HEADER)
|
|
|
+ if (le32_to_cpu(code_h.name) != INIT_HEADER)
|
|
|
break;
|
|
|
data_ptr += sizeof(code_h);
|
|
|
err = snd_sb_csp_load_user(p, data_ptr, le32_to_cpu(code_h.len),
|
|
@@ -391,7 +391,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
|
|
|
if (copy_from_user(&code_h, data_ptr, sizeof(code_h)))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- if (code_h.name != MAIN_HEADER) {
|
|
|
+ if (le32_to_cpu(code_h.name) != MAIN_HEADER) {
|
|
|
snd_printd("%s: Missing 'main' microcode\n", __func__);
|
|
|
return -EINVAL;
|
|
|
}
|