summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/matcd/matcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/isa/matcd/matcd.c')
-rw-r--r--sys/i386/isa/matcd/matcd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c
index 1809ec9..e57f387 100644
--- a/sys/i386/isa/matcd/matcd.c
+++ b/sys/i386/isa/matcd/matcd.c
@@ -2405,9 +2405,21 @@ static int matcd_toc_entries(int ldrive, int cdrive, int controller,
array from the kernel address space into the user address space
*/
- if (copyout(entries, ioc_entry->data,
- (trk)*sizeof(struct cd_toc_entry)) != 0) {
- return(EFAULT);
+ {
+ int len = ioc_entry->data_len;
+ int i = ioc_entry->starting_track - 1;
+ struct cd_toc_entry* from = &entries[i];
+ struct cd_toc_entry* to = ioc_entry->data;
+
+ while (i < trk && len >= sizeof(struct cd_toc_entry)) {
+ if (copyout(from, to, sizeof(struct cd_toc_entry)) != 0) {
+ return (EFAULT);
+ }
+ i++;
+ len -= sizeof(struct cd_toc_entry);
+ from++;
+ to++;
+ }
}
return(0);
OpenPOWER on IntegriCloud