[PATCH] xyzModem: Correct xmodem blk verification conditions

Hongbin Ji jhb_ee at 163.com
Tue Feb 6 03:49:25 CET 2024


When the blk sequence number is 255 and cblk is 0, the original XOR condition
produces a result of 0,and the judgment condition will be unsuccessful.

Signed-off-by: Hongbin Ji <jhb_ee at 163.com>
---
 common/xyzModem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/xyzModem.c b/common/xyzModem.c
index fb319f7119..0bc1a87067 100644
--- a/common/xyzModem.c
+++ b/common/xyzModem.c
@@ -373,7 +373,7 @@ xyzModem_get_hdr (void)
     }
   ZM_DEBUG (zm_dump (__LINE__));
   /* Validate the message */
-  if ((xyz.blk ^ xyz.cblk) != (unsigned char) 0xFF)
+  if (~xyz.blk != xyz.cblk)
     {
       ZM_DEBUG (zm_dprintf
 		("Framing error - blk: %x/%x/%x\n", xyz.blk, xyz.cblk,
-- 
2.34.1



More information about the U-Boot mailing list