Skip to content

Commit 69146a8

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
ubi: ubi_get_ec_info: Fix compiling error 'cast specifies array type'
On risc V platform, there is a type conversion for the return value (unsigned long type) of __untagged_addr_remote() in function untagged_addr(). The compiler will complain when the parameter 'addr' is an array type: arch/riscv/include/asm/uaccess.h:33:9: error: cast specifies array type (__force __typeof__(addr))__untagged_addr_remote(current->mm, __addr) Fix it by converting the input parameter as a pointer. Fixes: 01099f6 ("ubi: Implement ioctl for detailed erase counters") Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 01099f6 commit 69146a8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/mtd/ubi/cdev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,8 @@ static int ubi_get_ec_info(struct ubi_device *ubi, struct ubi_ecinfo_req __user
851851
end_peb = ubi->peb_count;
852852

853853
/* Check access rights before filling erase_counters array */
854-
if (!access_ok(ureq->erase_counters, (end_peb-req.start) * sizeof(int32_t)))
854+
if (!access_ok((void __user *)ureq->erase_counters,
855+
(end_peb-req.start) * sizeof(int32_t)))
855856
return -EFAULT;
856857

857858
/* Fill erase counter array */

0 commit comments

Comments
 (0)