i2c: amd-asf: Validate firmware-reported length

The firmware may sometimes return a length greater than the
allocated buffer size, which can lead to out-of-bounds access
and a kernel panic.

Currently, the driver does not validate the length read from
firmware.

Add a check to ensure the firmware-reported length stays within
the bounds of the data buffer.

Signed-off-by: Paritosh Potukuchi <paritosh.potukuchi@amd.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260612101815.4124804-1-paritosh.potukuchi@amd.com
This commit is contained in:
Paritosh Potukuchi 2026-06-12 10:18:15 +00:00 • committed by Andi Shyti
commit b2f4816a37
No known key found for this signature in database
GPG key ID: DA78056626D32D6E