aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/mixart
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-04-13 05:33:54 -0400
committerTakashi Iwai <tiwai@suse.de>2010-04-13 06:01:14 -0400
commitd97e1b78239c7e7e441088e0b644bd3b076002e6 (patch)
treeb05b5085bea932662ce60061d5b4b93834683327 /sound/pci/mixart
parent24e4a1211f691fc671de44685430dbad757d8487 (diff)
ALSA: info - Check file position validity in common layer
Check the validity of the file position in the common info layer before calling read or write callbacks in assumption that entry->size is set up properly to indicate the max file size. Removed the redundant checks from the callbacks as well. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/mixart')
-rw-r--r--sound/pci/mixart/mixart.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index b5df78bcc25b..be95e005c81d 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1161,13 +1161,7 @@ static ssize_t snd_mixart_BA0_read(struct snd_info_entry *entry,
1161 size_t count, loff_t pos) 1161 size_t count, loff_t pos)
1162{ 1162{
1163 struct mixart_mgr *mgr = entry->private_data; 1163 struct mixart_mgr *mgr = entry->private_data;
1164 unsigned long maxsize;
1165 1164
1166 if (pos >= MIXART_BA0_SIZE)
1167 return 0;
1168 maxsize = MIXART_BA0_SIZE - pos;
1169 if (count > maxsize)
1170 count = maxsize;
1171 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ 1165 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1172 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count)) 1166 if (copy_to_user_fromio(buf, MIXART_MEM(mgr, pos), count))
1173 return -EFAULT; 1167 return -EFAULT;
@@ -1183,13 +1177,7 @@ static ssize_t snd_mixart_BA1_read(struct snd_info_entry *entry,
1183 size_t count, loff_t pos) 1177 size_t count, loff_t pos)
1184{ 1178{
1185 struct mixart_mgr *mgr = entry->private_data; 1179 struct mixart_mgr *mgr = entry->private_data;
1186 unsigned long maxsize;
1187 1180
1188 if (pos > MIXART_BA1_SIZE)
1189 return 0;
1190 maxsize = MIXART_BA1_SIZE - pos;
1191 if (count > maxsize)
1192 count = maxsize;
1193 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */ 1181 count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
1194 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count)) 1182 if (copy_to_user_fromio(buf, MIXART_REG(mgr, pos), count))
1195 return -EFAULT; 1183 return -EFAULT;