summaryrefslogtreecommitdiff
path: root/drivers/ssb
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-02-20 23:49:23 -0800
committerKees Cook <kees@kernel.org>2026-02-21 01:02:28 -0800
commit69050f8d6d075dc01af7a5f2f550a8067510366f (patch)
treebb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/ssb
parentd39a1d7486d98668dd34aaa6732aad7977c45f5a (diff)
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/ssb')
-rw-r--r--drivers/ssb/bridge_pcmcia_80211.c2
-rw-r--r--drivers/ssb/driver_gige.c2
-rw-r--r--drivers/ssb/main.c2
-rw-r--r--drivers/ssb/pcihost_wrapper.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/drivers/ssb/bridge_pcmcia_80211.c b/drivers/ssb/bridge_pcmcia_80211.c
index ffa379efff83..6e958e403dbe 100644
--- a/drivers/ssb/bridge_pcmcia_80211.c
+++ b/drivers/ssb/bridge_pcmcia_80211.c
@@ -31,7 +31,7 @@ static int ssb_host_pcmcia_probe(struct pcmcia_device *dev)
int err = -ENOMEM;
int res = 0;
- ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
+ ssb = kzalloc_obj(*ssb, GFP_KERNEL);
if (!ssb)
goto out_error;
diff --git a/drivers/ssb/driver_gige.c b/drivers/ssb/driver_gige.c
index ebee6b0e3c34..fc2bf4ceedee 100644
--- a/drivers/ssb/driver_gige.c
+++ b/drivers/ssb/driver_gige.c
@@ -173,7 +173,7 @@ static int ssb_gige_probe(struct ssb_device *sdev,
struct ssb_gige *dev;
u32 base, tmslow, tmshigh;
- dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+ dev = kzalloc_obj(*dev, GFP_KERNEL);
if (!dev)
return -ENOMEM;
dev->dev = sdev;
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index aa6165e3db4a..bb52e5197b1f 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -481,7 +481,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
continue;
}
- devwrap = kzalloc(sizeof(*devwrap), GFP_KERNEL);
+ devwrap = kzalloc_obj(*devwrap, GFP_KERNEL);
if (!devwrap) {
err = -ENOMEM;
goto error;
diff --git a/drivers/ssb/pcihost_wrapper.c b/drivers/ssb/pcihost_wrapper.c
index dd70fd41c77d..36011a93f5af 100644
--- a/drivers/ssb/pcihost_wrapper.c
+++ b/drivers/ssb/pcihost_wrapper.c
@@ -71,7 +71,7 @@ static int ssb_pcihost_probe(struct pci_dev *dev,
int err = -ENOMEM;
u32 val;
- ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
+ ssb = kzalloc_obj(*ssb, GFP_KERNEL);
if (!ssb)
goto out;
err = pci_enable_device(dev);