[PATCH] xyzModem: Correct xmodem blk verification conditions

Tom Rini trini at konsulko.com
Tue Feb 6 14:48:39 CET 2024


On Tue, Feb 06, 2024 at 10:49:25AM +0800, Hongbin Ji wrote:

> 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,

As Dan noted before, this is very old code. Is there a problem you're
encountering in the real world? What has brought you to see a problem
and make a change here? Thanks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240206/f76f8759/attachment.sig>


More information about the U-Boot mailing list