aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/gus
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/isa/gus
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/isa/gus')
-rw-r--r--sound/isa/gus/gus_mem_proc.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
index b2d2dba6c860..faa2bec8f6b6 100644
--- a/sound/isa/gus/gus_mem_proc.c
+++ b/sound/isa/gus/gus_mem_proc.c
@@ -36,20 +36,14 @@ static ssize_t snd_gf1_mem_proc_dump(struct snd_info_entry *entry,
36 struct file *file, char __user *buf, 36 struct file *file, char __user *buf,
37 size_t count, loff_t pos) 37 size_t count, loff_t pos)
38{ 38{
39 long size;
40 struct gus_proc_private *priv = entry->private_data; 39 struct gus_proc_private *priv = entry->private_data;
41 struct snd_gus_card *gus = priv->gus; 40 struct snd_gus_card *gus = priv->gus;
42 int err; 41 int err;
43 42
44 size = count; 43 err = snd_gus_dram_read(gus, buf, pos, count, priv->rom);
45 if (pos + size > priv->size) 44 if (err < 0)
46 size = (long)priv->size - pos; 45 return err;
47 if (size > 0) { 46 return count;
48 if ((err = snd_gus_dram_read(gus, buf, pos, size, priv->rom)) < 0)
49 return err;
50 return size;
51 }
52 return 0;
53} 47}
54 48
55static loff_t snd_gf1_mem_proc_llseek(struct snd_info_entry *entry, 49static loff_t snd_gf1_mem_proc_llseek(struct snd_info_entry *entry,