/* Returns 0 on success or -EINVAL, -EFAULT, -EAGAIN in case of an error.  */
static int convert_type86_xcrb(struct zcrypt_device *zdev, struct ap_message *reply, struct ica_xcRB *xcRB)
/* Returns 0 on success or -EINVAL, -EFAULT, -EAGAIN in case of an error.  */
static int convert_type86_xcrb(struct zcrypt_device *zdev, struct ap_message *reply, struct ica_xcRB *xcRB)
{
	struct type86_fmt2_msg *msg = reply->message;
	char *data = reply->message;
	if (copy_to_user(xcRB->reply_control_blk_addr,
		data + msg->fmt2.offset1, msg->fmt2.count1))
		return -EFAULT;
	xcRB->reply_control_blk_length = msg->fmt2.count1;
	if (msg->fmt2.count2)
		if (copy_to_user(xcRB->reply_data_addr,
			data + msg->fmt2.offset2, msg->fmt2.count2))
			return -EFAULT;
	xcRB->reply_data_length = msg->fmt2.count2;
	return 0;
}