Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 423688ab authored by Frederic Barrat's avatar Frederic Barrat Committed by Michael Ellerman
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: default avatarAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 521ca5a9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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;
}