Re:Re: [PATCH v3 2/2] hwmon: (lenovo-ec-sensors): Fix EC "MCHP" signature validation logic

From: 任海

Date: Thu May 21 2026 - 21:36:13 EST




Hi Guenter,
Thanks for your patient review and approval.
Kean













At 2026-05-21 21:46:00, "Guenter Roeck" <linux@xxxxxxxxxxxx> wrote:
>On Thu, May 21, 2026 at 11:52:28AM +0800, Kean Ren wrote:
>> The EC signature check uses && instead of || between the four
>> byte comparisons. With &&, the condition is true only when ALL
>> four bytes fail to match simultaneously, meaning the driver
>> accepts a device as a valid Microchip EC if ANY single byte of
>> the 4-byte "MCHP" signature happens to match.
>>
>> Due to short-circuit evaluation, if the first byte reads back as
>> 'M' (0x4D, a very common register value), the remaining three
>> comparisons are skipped entirely and the device is accepted.
>>
>> Change && to || so the check rejects devices that do not fully
>> match the expected EC signature, as originally intended.
>>
>> Reviewed-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
>> Signed-off-by: Kean Ren <rh_king@xxxxxxx>
>
>Applied.
>
>Thanks,
>Guenter