[PATCH 0/5] driver core: Prevent device_find_child() from modifying caller's match data
From: Zijun Hu
Date: Sat Aug 10 2024 - 20:19:02 EST
For driver API:
struct device *device_find_child(struct device *dev, void *data,
int (*match)(struct device *dev, void *data));
It does not make sense for its match function (*match)() to modify
caller's match data @*data, but there are 3 device_find_child() usages
whose match functions do such awful things within current kernel tree.
This patch series is to clean up them first to prepare to constify the API.
Previous discussion link:
https://lore.kernel.org/lkml/917359cc-a421-41dd-93f4-d28937fe2325@xxxxxxxxxx
Signed-off-by: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
---
Zijun Hu (5):
driver core: Add simple parameter checks for APIs device_(for_each|find)_child()
driver core: Introduce an API constify_device_find_child_helper()
cxl/region: Prevent device_find_child() from modifying caller's match data
firewire: core: Prevent device_find_child() from modifying caller's match data
net: qcom/emac: Prevent device_find_child() from modifying caller's match data
drivers/base/core.c | 41 +++++++++++++++++++++++--
drivers/cxl/core/region.c | 3 +-
drivers/firewire/core-device.c | 5 +--
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c | 5 +--
include/linux/device.h | 7 +++++
5 files changed, 53 insertions(+), 8 deletions(-)
---
base-commit: bfa54a793ba77ef696755b66f3ac4ed00c7d1248
change-id: 20240811-const_dfc_prepare-3ff23c6598e5
Best regards,
--
Zijun Hu <quic_zijuhu@xxxxxxxxxxx>