From 3a58926d01cf52cc743a938f7e227d09bbe7ab66 Mon Sep 17 00:00:00 2001 From: Brennan Ashton Date: Sun, 19 Jul 2020 16:53:22 +0000 Subject: [PATCH] Cast pointer to uintptr prior to ulong for ioctl Signed-off-by: Brennan Ashton --- fs/driver/fs_blockpartition.c | 8 +++++--- fs/partition/fs_partition.c | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/driver/fs_blockpartition.c b/fs/driver/fs_blockpartition.c index f42d7fc240..1dda522f91 100644 --- a/fs/driver/fs_blockpartition.c +++ b/fs/driver/fs_blockpartition.c @@ -224,6 +224,7 @@ static int part_geometry(FAR struct inode *inode, struct geometry *geometry) static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) { + FAR uintptr_t ptr_arg = (uintptr_t)arg; FAR struct part_struct_s *dev = inode->i_private; FAR struct inode *parent = dev->parent; int ret = -ENOTTY; @@ -232,7 +233,8 @@ static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) { if (cmd == MTDIOC_PROTECT || cmd == MTDIOC_UNPROTECT) { - FAR struct mtd_protect_s *prot = (FAR struct mtd_protect_s *)arg; + FAR struct mtd_protect_s *prot = + (FAR struct mtd_protect_s *)ptr_arg; prot->startblock += dev->firstsector; } @@ -242,7 +244,7 @@ static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) { if (cmd == BIOC_XIPBASE || cmd == MTDIOC_XIPBASE) { - FAR void **base = (FAR void **)arg; + FAR void **base = (FAR void **)ptr_arg; struct geometry geo; ret = parent->u.i_bops->geometry(parent, &geo); @@ -255,7 +257,7 @@ static int part_ioctl(FAR struct inode *inode, int cmd, unsigned long arg) else if (cmd == MTDIOC_GEOMETRY) { FAR struct mtd_geometry_s *mgeo = - (FAR struct mtd_geometry_s *)arg; + (FAR struct mtd_geometry_s *)ptr_arg; uint32_t blkper = mgeo->erasesize / mgeo->blocksize; mgeo->neraseblocks = dev->nsectors / blkper; diff --git a/fs/partition/fs_partition.c b/fs/partition/fs_partition.c index 4e065e6d38..f9d3fc9953 100644 --- a/fs/partition/fs_partition.c +++ b/fs/partition/fs_partition.c @@ -156,7 +156,8 @@ int parse_block_partition(FAR const char *path, state.mtd = NULL; - ret = state.blk->u.i_bops->ioctl(state.blk, MTDIOC_GEOMETRY, (unsigned long)&mgeo); + ret = state.blk->u.i_bops->ioctl( + state.blk, MTDIOC_GEOMETRY, (unsigned long)(uintptr_t)&mgeo); if (ret >= 0) { state.blocksize = mgeo.blocksize; @@ -207,7 +208,7 @@ int parse_mtd_partition(FAR struct mtd_dev_s *mtd, struct mtd_geometry_s mgeo; int ret; - ret = mtd->ioctl(mtd, MTDIOC_GEOMETRY, (unsigned long)&mgeo); + ret = mtd->ioctl(mtd, MTDIOC_GEOMETRY, (unsigned long)(uintptr_t)&mgeo); if (ret < 0) { return ret;