mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] scripts: kwboot: fix comparison with out-of-range constant
@ 2019-05-27  7:25 Ahmad Fatoum
  2019-05-28  9:59 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2019-05-27  7:25 UTC (permalink / raw)
  To: barebox

clang detects that system char signedness will affect program runtime:
scripts/kwboot.c:395:10: warning: result of comparison of constant 255
with expression of type 'char' is always true
[-Wtautological-constant-out-of-range-compare]
                if (*p != 0xff)
                    ~~ ^  ~~~~

Fix this by using uint8_t where appropriate.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 scripts/kwboot.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index df52144e45c4..43b8b8cbcdc6 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -378,10 +378,10 @@ kwboot_xm_resync(int fd)
 	 * there is another problem.
 	 */
 	int rc;
-	char buf[sizeof(struct kwboot_block)];
+	uint8_t buf[sizeof(struct kwboot_block)];
 	unsigned interval = 1;
 	unsigned len;
-	char *p = buf;
+	uint8_t *p = buf;
 
 	memset(buf, 0xff, sizeof(buf));
 
@@ -407,7 +407,7 @@ static int
 kwboot_xm_sendblock(int fd, struct kwboot_block *block)
 {
 	int rc, retries;
-	char c;
+	uint8_t c;
 
 	retries = 16;
 	do {
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] scripts: kwboot: fix comparison with out-of-range constant
  2019-05-27  7:25 [PATCH] scripts: kwboot: fix comparison with out-of-range constant Ahmad Fatoum
@ 2019-05-28  9:59 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-05-28  9:59 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Mon, May 27, 2019 at 09:25:57AM +0200, Ahmad Fatoum wrote:
> clang detects that system char signedness will affect program runtime:
> scripts/kwboot.c:395:10: warning: result of comparison of constant 255
> with expression of type 'char' is always true
> [-Wtautological-constant-out-of-range-compare]
>                 if (*p != 0xff)
>                     ~~ ^  ~~~~
> 
> Fix this by using uint8_t where appropriate.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  scripts/kwboot.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-28  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27  7:25 [PATCH] scripts: kwboot: fix comparison with out-of-range constant Ahmad Fatoum
2019-05-28  9:59 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox