Re: [PATCH v2 next] ACPI: APEI: EINJ: prevent memory corruption in error_type_set()

From: Dan Carpenter
Date: Wed Jun 25 2025 - 14:43:19 EST


On Wed, Jun 25, 2025 at 06:22:57PM +0000, Luck, Tony wrote:
> > > + if (count > sizeof(einj_buf))
>
> Why not:
> /* Leave the last character for the NUL terminator */
> if (count > sizeof(einj_buf) - 1)
> return -EINVAL;
>
> here. Then skip the min(...) addition below.

Yeah. You're right. That's a better fix.

regards,
dan carpenter