Re: [PATCH v2] platform/x86: lenovo: wmi-other: Fix uninitialized

From: Yufei CHENG

Date: Sun Apr 26 2026 - 13:43:58 EST


Hi Rong,

Thanks for your feedback, I've corrected the format and resend the patch.
However I think I have to point out some other issues in this file.

First, we should not complexify simple things. You use lwmi_om_fan_get_set() to
combine get and set into a single function with a boolean flag to determine the
action.
This makes the control flow harder to follow and audit. Furthermore, this layer
of abstraction is not applied constantly throughout the whole file. In some
places, values are set through lwmi_om_fan_get_set() and in other places,
they're called manually through lwmi_dev_evaluate_int()
This inconsistency makes the abstraction pointless and is the direct cause of a
second uninitialized bug

In line 855, args.arg0 is set to attribute_id, but arg1 is never set. Though
arg1 is omitted in read action, you're still passing stack garbage to the
lwmi_dev_evaluate_int(). And I think it's better to zero it out if not used.

Additionally, I doubt whether bypassing the minimum RPM divisor has any
practical use at all, not to mention it's not guranteed to work and purely
depends on whether EC accepts that sub-division value.

I may do some refactor recently, and I'm happy to hear your suggestions.

Thanks,
Yufei