Thread (4 messages) 4 messages, 2 authors, 8d ago

Re: [PATCH] Input: axp20x-pek - add AXP313a support

From: Влад СВН <hidden>
Date: 2026-09-23 11:23:27
Also in: linux-sunxi, sashiko-reviews

This is already addressed in v2 [1]: the AXP313a no longer reuses
axp20x_info. It has its own axp313a_info without start-up/shutdown
times, and the startup/shutdown attributes are hidden through
is_visible(), so they are not created and no out-of-range access to
AXP20X_PEK_KEY happens.

ср, 23 сент. 2026 г. в 16:07, [off-list ref]:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] input: broken AXP313a sysfs attributes due to out-of-bounds regmap access
--

commit fbaeccab4996537ab99d0c8423e2cf36610e4b34
Author: Vladimir [off-list ref]

Input: axp20x-pek - add AXP313a support

This commit adds the AXP313a PMIC platform ID to the axp20x-pek driver to
enable the power button. It uses the axp20x_info generic register layout.
quoted
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index 24f9e9d893de3..d4e2fc9a937ff 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -393,6 +393,10 @@ static const struct platform_device_id axp_pek_id_match[] = {
              .name = "axp221-pek",
              .driver_data = (kernel_ulong_t)&axp221_info,
      },
+     {
+             .name = "axp313a-pek",
+             .driver_data = (kernel_ulong_t)&axp20x_info,
[Severity: Medium]
Will reusing axp20x_info break the sysfs attributes startup and shutdown for
the AXP313a?

When these sysfs attributes are accessed, the driver calls:

axp20x_show_attr()
  regmap_read(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, &val);

axp20x_store_attr()
  regmap_update_bits(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY, mask, idx);

Since AXP20X_PEK_KEY is 0x36, but the AXP313a regmap defines max_register
as 0x21, won't the regmap core block this out-of-bounds access and return
an error?
quoted
+     },
      { /* sentinel */ }
 };
MODULE_DEVICE_TABLE(platform, axp_pek_id_match);

--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923105757.260-1-anykey196@gmail.com?part=1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help