提交 423688ab 编写于 作者: F Frederic Barrat 提交者: Michael Ellerman

ocxl: Fix potential bad errno on irq allocation

Fix some issues found by a static checker:

When allocating an AFU interrupt, if the driver cannot copy the output
parameters to userland, the errno value was not set to EFAULT

Remove a (now) useless cast.
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: NAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 521ca5a9
......@@ -133,8 +133,10 @@ static long afu_ioctl(struct file *file, unsigned int cmd,
if (!rc) {
rc = copy_to_user((u64 __user *) args, &irq_offset,
sizeof(irq_offset));
if (rc)
if (rc) {
ocxl_afu_irq_free(ctx, irq_offset);
return -EFAULT;
}
}
break;
......@@ -329,7 +331,7 @@ static ssize_t afu_read(struct file *file, char __user *buf, size_t count,
used += sizeof(header);
rc = (ssize_t) used;
rc = used;
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册