[PATCH] scripts: kwboot: fix comparison with out-of-range constant

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

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux