<blush> copyout on read, not write.

Tweak a comment while I'm here.
This commit is contained in:
Warner Losh 2006-11-22 06:03:39 +00:00
parent 88277acb0b
commit 64e043166e

View File

@ -306,7 +306,7 @@ iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs);
if (error)
break;
/* Allocate kernel buffers for userland data, copyin write data */
/* Alloc kernel buffers for userland data, copyin write data */
for (i = 0; i < d->nmsgs; i++) {
m = &((struct iic_msg *)buf)[i];
usrbufs[i] = m->buf;
@ -318,7 +318,7 @@ iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t
/* Copyout all read segments, free up kernel buffers */
for (i = 0; i < d->nmsgs; i++) {
m = &((struct iic_msg *)buf)[i];
if (!(m->flags & IIC_M_RD))
if (m->flags & IIC_M_RD)
copyout(m->buf, usrbufs[i], m->len);
free(m->buf, M_TEMP);
}