All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Orzel <michal.orzel@arm.com>
To: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>
Subject: [PATCH 7/9] common/libfdt: Use explicitly specified types
Date: Mon, 20 Jun 2022 09:02:43 +0200	[thread overview]
Message-ID: <20220620070245.77979-8-michal.orzel@arm.com> (raw)
In-Reply-To: <20220620070245.77979-1-michal.orzel@arm.com>

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@arm.com>
---
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



  parent reply	other threads:[~2022-06-20  7:03 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  7:02 [PATCH 0/9] MISRA C 2012 8.1 rule fixes Michal Orzel
2022-06-20  7:02 ` [PATCH 1/9] xen/arm: Use explicitly specified types Michal Orzel
2022-06-20  9:47   ` Julien Grall
2022-06-20  7:02 ` [PATCH 2/9] xen/domain: " Michal Orzel
2022-06-20  9:48   ` Julien Grall
2022-06-20  7:02 ` [PATCH 3/9] xen/common: " Michal Orzel
2022-06-20  9:49   ` Julien Grall
2022-06-20  9:51   ` Juergen Gross
2022-06-20  7:02 ` [PATCH 4/9] include/xen: " Michal Orzel
2022-06-20  9:53   ` Julien Grall
2022-06-20  7:02 ` [PATCH 5/9] include/public: " Michal Orzel
2022-06-20  9:54   ` Julien Grall
2022-06-20 10:07     ` Andrew Cooper
2022-06-21  8:43     ` Michal Orzel
2022-06-21  8:46       ` Julien Grall
2022-06-22 10:16   ` Jan Beulich
2022-06-22 10:56     ` Michal Orzel
2022-06-20  7:02 ` [PATCH 6/9] xsm/flask: " Michal Orzel
2022-06-21 14:27   ` Jason Andryuk
2022-06-20  7:02 ` Michal Orzel [this message]
2022-06-20  9:56   ` [PATCH 7/9] common/libfdt: " Julien Grall
2022-06-20  7:02 ` [PATCH 8/9] common/inflate: " Michal Orzel
2022-06-20  7:02 ` [PATCH 9/9] drivers/acpi: " Michal Orzel
2022-06-22 10:36   ` Jan Beulich
2022-06-22 11:09     ` Michal Orzel
2022-06-22 11:45       ` Jan Beulich
2022-06-22 10:25 ` [PATCH 0/9] MISRA C 2012 8.1 rule fixes Jan Beulich
2022-06-22 12:55   ` Michal Orzel
2022-06-22 13:01     ` Jan Beulich
2022-06-22 13:55       ` Bertrand Marquis
2022-06-22 14:10         ` Jan Beulich
2022-06-22 14:27           ` Bertrand Marquis
2022-06-22 14:41             ` Jan Beulich
2022-06-22 19:23               ` Stefano Stabellini
2022-06-23  7:32                 ` Jan Beulich
2022-06-23  7:37                 ` Roberto Bagnara
2022-06-23  7:51                   ` Jan Beulich
2022-06-23 18:23                     ` Stefano Stabellini
2022-06-23 21:14                     ` Roberto Bagnara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220620070245.77979-8-michal.orzel@arm.com \
    --to=michal.orzel@arm.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.