[PATCH] rfs: fix pointer conversion warnings

Gedare Bloom gedare at rtems.org
Thu Oct 16 05:02:09 UTC 2014


I did not commit this one, because it has the problem of assuming
uintptr_t is at least 32-bits wide.

On Tue, Oct 14, 2014 at 12:03 AM, Gedare Bloom <gedare at rtems.org> wrote:
> On Mon, Oct 13, 2014 at 10:54 PM, Joel Sherrill
> <joel.sherrill at oarcorp.com> wrote:
>>
>>
>> On October 13, 2014 9:46:50 PM CDT, Gedare Bloom <gedare at rtems.org> wrote:
>>>---
>>> cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>>diff --git a/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
>>>b/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
>>>index 28e4739..48a6737 100644
>>>--- a/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
>>>+++ b/cpukit/libfs/src/rfs/rtems-rfs-rtems-dev.c
>>>@@ -30,7 +30,7 @@ rtems_rfs_rtems_device_get_major_and_minor ( const
>>>rtems_libio_t       *iop,
>>>                                      rtems_device_minor_number *minor)
>>> {
>>>   *major = iop->data0;
>>>-  *minor = (rtems_device_minor_number) iop->data1;
>>>+  *minor = (rtems_device_minor_number)(uintptr_t) iop->data1;
>>> }
>>>
>>
>> Isn't the minor always 32 bits? Could this shorten the value?
>>
> Maybe on a target where unsigned int is 16 bits, but void* is 32 bits?
>  Somehow I don't think such a target exists.
>
>>> /**
>>>@@ -77,7 +77,7 @@ rtems_rfs_rtems_device_open ( rtems_libio_t *iop,
>>>   rtems_rfs_rtems_unlock (fs);
>>>
>>>   iop->data0 = major;
>>>-  iop->data1 = (void *) minor;
>>>+  iop->data1 = (void *)(uintptr_t) minor;
>>>
>>
>> This seems OK if the data value goes in OK.
>>
>>> return rtems_deviceio_open (iop, pathname, oflag, mode, minor, major);
>>> }
>>



More information about the devel mailing list