}
}
- copy_to_user(buffer, &slot->msg, sizeof(struct canmsg_t));
+ ret = copy_to_user(buffer, &slot->msg, sizeof(struct canmsg_t));
canque_free_outslot(qends, qedge, slot);
buffer += sizeof(struct canmsg_t);
bytes_to_copy = length-sizeof(struct canmsg_t);
+ if(ret) return -EFAULT;
while (bytes_to_copy > 0) {
ret=canque_test_outslot(qends, &qedge, &slot);
if(ret<0)
break;
- copy_to_user(buffer, &slot->msg, sizeof(struct canmsg_t));
+ ret = copy_to_user(buffer, &slot->msg, sizeof(struct canmsg_t));
canque_free_outslot(qends, qedge, slot);
buffer += sizeof(struct canmsg_t);
bytes_to_copy -= sizeof(struct canmsg_t);
+ if(ret) return -EFAULT;
}
return length-bytes_to_copy;