Commit e0d8e8de8bcb for kernel
commit e0d8e8de8bcb1ef7b749033b5af5518ba8df7bec
Merge: 8a65162514fb 4dd10fbbeb9c
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun Nov 8 14:55:54 2026 -0800
Merge tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull devm_kmalloc_obj conversion from Kees Cook:
- treewide refresh of kmalloc_obj() conversions
- devm_kmalloc_obj conversion rules added to Coccinelle scripting
- treewide conversion of devm_kmalloc() family to devm_kmalloc_obj()
* tag 'devm_kmalloc_obj-v7.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family
coccinelle: kmalloc_obj: Include devm_kmalloc_obj conversion rules
treewide: refresh kmalloc_obj() conversions
diff --cc drivers/hwmon/aquacomputer_d5next.c
index 3d3786c82931,6fbb3962f791..f521a6142a13
--- a/drivers/hwmon/aquacomputer_d5next.c
+++ b/drivers/hwmon/aquacomputer_d5next.c
@@@ -1540,10 -1518,9 +1540,10 @@@ static void aqc_debugfs_init(struct aqc
static int aqc_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
struct aqc_data *priv;
+ u16 min_report_size = 0;
int ret;
- priv = devm_kzalloc(&hdev->dev, sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc_obj(&hdev->dev, *priv);
if (!priv)
return -ENOMEM;
diff --cc drivers/hwmon/asus_wmi_sensors.c
index 0feab3f62496,372796d05bb0..9e45cca22c6b
--- a/drivers/hwmon/asus_wmi_sensors.c
+++ b/drivers/hwmon/asus_wmi_sensors.c
@@@ -545,13 -547,12 +543,13 @@@ static int asus_wmi_configure_sensor_se
if (!ptr_asus_wmi_ci)
return -ENOMEM;
- asus_wmi_chip_info.info = ptr_asus_wmi_ci;
- chip_info = &asus_wmi_chip_info;
+ chip_info = &sensor_data->chip_info;
+ chip_info->ops = &asus_wmi_hwmon_ops;
+ chip_info->info = ptr_asus_wmi_ci;
- sensor_data->wmi.info_by_id = devm_kcalloc(dev, sensor_data->wmi.sensor_count,
- sizeof(*sensor_data->wmi.info_by_id),
- GFP_KERNEL);
+ sensor_data->wmi.info_by_id = devm_kzalloc_objs(dev,
+ *sensor_data->wmi.info_by_id,
+ sensor_data->wmi.sensor_count);
if (!sensor_data->wmi.info_by_id)
return -ENOMEM;
diff --cc drivers/hwmon/pmbus/pmbus_core.c
index 8fa379d04cd1,093b543b95b5..82dac2c6c579
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@@ -1554,11 -1546,10 +1554,11 @@@ static struct pmbus_sensor *pmbus_add_s
{
struct sensor_device_attribute *a;
struct pmbus_sensor *sensor;
+ int err;
- sensor = devm_kzalloc(data->dev, sizeof(*sensor), GFP_KERNEL);
+ sensor = devm_kzalloc_obj(data->dev, *sensor);
if (!sensor)
- return NULL;
+ return ERR_PTR(-ENOMEM);
a = &sensor->attribute;
if (type)
diff --cc drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 10b61fa2c27c,e948e3c8c8ac..c7696b19d072
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@@ -1019,29 -1013,33 +1016,29 @@@ static int tc_taprio_configure(struct s
if (qopt->cmd == TAPRIO_CMD_DESTROY)
goto disable;
- if (qopt->num_entries > dep)
- return -EINVAL;
- if (!qopt->cycle_time)
- return -ERANGE;
- if (qopt->cycle_time_extension >= BIT(wid + 7))
- return -ERANGE;
-
- if (!priv->est) {
- priv->est = devm_kzalloc_obj(priv->device, *priv->est);
- if (!priv->est)
- return -ENOMEM;
+ if (qopt->num_entries > dep) {
+ ret = -EINVAL;
+ goto error_unlock;
+ }
- mutex_init(&priv->est_lock);
- } else {
- mutex_lock(&priv->est_lock);
- memset(priv->est, 0, sizeof(*priv->est));
- mutex_unlock(&priv->est_lock);
+ if (!qopt->cycle_time ||
+ qopt->cycle_time > (u64)U32_MAX * NSEC_PER_SEC) {
+ ret = -ERANGE;
+ goto error_unlock;
}
- size = qopt->num_entries;
+ if (qopt->cycle_time_extension >= BIT(wid + 7)) {
+ ret = -ERANGE;
+ goto error_unlock;
+ }
- gcl = kcalloc(qopt->num_entries, sizeof(*gcl), GFP_KERNEL);
- mutex_lock(&priv->est_lock);
- priv->est->gcl_size = size;
- priv->est->enable = qopt->cmd == TAPRIO_CMD_REPLACE;
- mutex_unlock(&priv->est_lock);
++ gcl = kzalloc_objs(*gcl, qopt->num_entries);
+ if (!gcl) {
+ ret = -ENOMEM;
+ goto error_unlock;
+ }
- for (i = 0; i < size; i++) {
+ for (i = 0; i < qopt->num_entries; i++) {
s64 delta_ns = qopt->entries[i].interval;
u32 gates = qopt->entries[i].gate_mask;
@@@ -1065,26 -1058,13 +1062,25 @@@
gates &= ~BIT(0);
break;
default:
- return -EOPNOTSUPP;
+ ret = -EOPNOTSUPP;
+ goto error_unlock;
}
- priv->est->gcl[i] = delta_ns | (gates << wid);
+ gcl[i] = delta_ns | (gates << wid);
}
- mutex_lock(&priv->est_lock);
+ if (!priv->est) {
- priv->est = devm_kzalloc(priv->device, sizeof(*priv->est),
- GFP_KERNEL);
++ priv->est = devm_kzalloc_obj(priv->device, *priv->est);
+ if (!priv->est) {
+ ret = -ENOMEM;
+ goto error_unlock;
+ }
+ } else {
+ memset(priv->est, 0, sizeof(*priv->est));
+ }
+ memcpy(priv->est->gcl, gcl, sizeof(*gcl) * qopt->num_entries);
+ priv->est->gcl_size = qopt->num_entries;
+
/* Adjust for real system time */
priv->ptp_clock_ops.gettimex64(&priv->ptp_clock_ops, ¤t_time,
NULL);