diff options
Diffstat (limited to 'sound/pci/cs46xx/cs46xx_lib.c')
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 08117b142381..aad37082cb6e 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -2662,17 +2662,11 @@ static ssize_t snd_cs46xx_io_read(struct snd_info_entry *entry, | |||
2662 | struct file *file, char __user *buf, | 2662 | struct file *file, char __user *buf, |
2663 | size_t count, loff_t pos) | 2663 | size_t count, loff_t pos) |
2664 | { | 2664 | { |
2665 | long size; | ||
2666 | struct snd_cs46xx_region *region = entry->private_data; | 2665 | struct snd_cs46xx_region *region = entry->private_data; |
2667 | 2666 | ||
2668 | size = count; | 2667 | if (copy_to_user_fromio(buf, region->remap_addr + pos, count)) |
2669 | if (pos + (size_t)size > region->size) | 2668 | return -EFAULT; |
2670 | size = region->size - pos; | 2669 | return count; |
2671 | if (size > 0) { | ||
2672 | if (copy_to_user_fromio(buf, region->remap_addr + pos, size)) | ||
2673 | return -EFAULT; | ||
2674 | } | ||
2675 | return size; | ||
2676 | } | 2670 | } |
2677 | 2671 | ||
2678 | static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { | 2672 | static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = { |