Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mfd: qnap-mcu: Calculate the checksum on the actual number of bytes received

In the case of an error message, the number of received bytes can be
less than originally expected but still contain a valid message.

If the transfer itself ended in an error we would exit earlier already.

So calculate the checksum on the number of received bytes and not the
number of expected bytes.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patch.msgid.link/20251113165218.449616-2-heiko@sntech.de
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Heiko Stuebner and committed by
Lee Jones
b4881070 46bddb5f

+2 -2
+2 -2
drivers/mfd/qnap-mcu.c
··· 175 175 return -ETIMEDOUT; 176 176 } 177 177 178 - crc = qnap_mcu_csum(rx, reply_data_size); 179 - if (crc != rx[reply_data_size]) { 178 + crc = qnap_mcu_csum(rx, reply->received - QNAP_MCU_CHECKSUM_SIZE); 179 + if (crc != rx[reply->received - QNAP_MCU_CHECKSUM_SIZE]) { 180 180 dev_err(&mcu->serdev->dev, "Invalid Checksum received\n"); 181 181 return -EIO; 182 182 }