Skip to content

Commit

Permalink
drivers/ydn23.h: fix bad lchksum
Browse files Browse the repository at this point in the history
Fix a bad checksum in length field. However, `liebert-gxe' was not affected because the frame never exceeds 2^4-1.

Signed-off-by: Gong Zhile <[email protected]>
  • Loading branch information
goodspeed34 authored Nov 3, 2024
1 parent 62c43ea commit d244d73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/ydn23.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ static inline void ydn23_lchecksum(uint16_t dlen, char *out)

/* Sum all four 4 bits */
lenchk += lelen & 0x000f;
lenchk += lelen & 0x00f0;
lenchk += lelen & 0x0f00;
lenchk += lelen & 0xf000;
lenchk += (lelen & 0x00f0) >> 4;
lenchk += (lelen & 0x0f00) >> 8;
lenchk += (lelen & 0xf000) >> 12;

lenchk %= 16;
lenchk = ~lenchk + 1;
Expand Down

0 comments on commit d244d73

Please sign in to comment.