[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 7/9] common/libfdt: Use explicitly specified types



According to MISRA C 2012 Rule 8.1, types shall be explicitly
specified. Fix all the findings reported by cppcheck with misra addon
by substituting implicit type 'unsigned' to explicit 'unsigned int'.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
This patch may not be applicable as these files come from libfdt.
---
 xen/common/libfdt/fdt_ro.c  | 4 ++--
 xen/common/libfdt/fdt_rw.c  | 2 +-
 xen/common/libfdt/fdt_sw.c  | 2 +-
 xen/common/libfdt/fdt_wip.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/common/libfdt/fdt_ro.c b/xen/common/libfdt/fdt_ro.c
index 17584da257..0fc4f793fe 100644
--- a/xen/common/libfdt/fdt_ro.c
+++ b/xen/common/libfdt/fdt_ro.c
@@ -53,7 +53,7 @@ const char *fdt_get_string(const void *fdt, int stroffset, 
int *lenp)
 
        err = -FDT_ERR_BADOFFSET;
        absoffset = stroffset + fdt_off_dt_strings(fdt);
-       if (absoffset >= (unsigned)totalsize)
+       if (absoffset >= (unsigned int)totalsize)
                goto fail;
        len = totalsize - absoffset;
 
@@ -61,7 +61,7 @@ const char *fdt_get_string(const void *fdt, int stroffset, 
int *lenp)
                if (stroffset < 0)
                        goto fail;
                if (can_assume(LATEST) || fdt_version(fdt) >= 17) {
-                       if ((unsigned)stroffset >= fdt_size_dt_strings(fdt))
+                       if ((unsigned int)stroffset >= fdt_size_dt_strings(fdt))
                                goto fail;
                        if ((fdt_size_dt_strings(fdt) - stroffset) < len)
                                len = fdt_size_dt_strings(fdt) - stroffset;
diff --git a/xen/common/libfdt/fdt_rw.c b/xen/common/libfdt/fdt_rw.c
index 3621d3651d..1707238ebc 100644
--- a/xen/common/libfdt/fdt_rw.c
+++ b/xen/common/libfdt/fdt_rw.c
@@ -59,7 +59,7 @@ static int fdt_splice_(void *fdt, void *splicepoint, int 
oldlen, int newlen)
 
        if ((oldlen < 0) || (soff + oldlen < soff) || (soff + oldlen > dsize))
                return -FDT_ERR_BADOFFSET;
-       if ((p < (char *)fdt) || (dsize + newlen < (unsigned)oldlen))
+       if ((p < (char *)fdt) || (dsize + newlen < (unsigned int)oldlen))
                return -FDT_ERR_BADOFFSET;
        if (dsize - oldlen + newlen > fdt_totalsize(fdt))
                return -FDT_ERR_NOSPACE;
diff --git a/xen/common/libfdt/fdt_sw.c b/xen/common/libfdt/fdt_sw.c
index 4c569ee7eb..eb694b5dbb 100644
--- a/xen/common/libfdt/fdt_sw.c
+++ b/xen/common/libfdt/fdt_sw.c
@@ -162,7 +162,7 @@ int fdt_resize(void *fdt, void *buf, int bufsize)
            headsize + tailsize > fdt_totalsize(fdt))
                return -FDT_ERR_INTERNAL;
 
-       if ((headsize + tailsize) > (unsigned)bufsize)
+       if ((headsize + tailsize) > (unsigned int)bufsize)
                return -FDT_ERR_NOSPACE;
 
        oldtail = (char *)fdt + fdt_totalsize(fdt) - tailsize;
diff --git a/xen/common/libfdt/fdt_wip.c b/xen/common/libfdt/fdt_wip.c
index c2d7566a67..82db674014 100644
--- a/xen/common/libfdt/fdt_wip.c
+++ b/xen/common/libfdt/fdt_wip.c
@@ -23,7 +23,7 @@ int fdt_setprop_inplace_namelen_partial(void *fdt, int 
nodeoffset,
        if (!propval)
                return proplen;
 
-       if ((unsigned)proplen < (len + idx))
+       if ((unsigned int)proplen < (len + idx))
                return -FDT_ERR_NOSPACE;
 
        memcpy((char *)propval + idx, val, len);
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.