summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-09-05 20:45:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-09-05 20:45:18 -0700
commit1fc5a74b108fc90951890ec513ac81869f5eaff1 (patch)
treeddd247abac0e8e148e4ded357db093bee4fe35ed /drivers/scsi
parent9f0346dcbea363787186c94ef94dd01aaa215afa (diff)
parent3a2c4d55e32ad65efebdb6de44eef3bfa08bb49d (diff)
downloadlinux-stable-1fc5a74b108fc90951890ec513ac81869f5eaff1.tar.gz
linux-stable-1fc5a74b108fc90951890ec513ac81869f5eaff1.zip
Merge tag 'kmalloc_obj-v7.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull kmalloc_obj conversions from Kees Cook: "Another run of the Coccinelle script for converting kmalloc() family of allocations to kmalloc_obj() via the existing rules in scripts/coccinelle/api/kmalloc_objs.cocci" * tag 'kmalloc_obj-v7.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: treewide: refresh kmalloc_obj() conversions drm/amd/display: Fix harmless type mismatch in allocation
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/fnic/fnic_debugfs.c2
-rw-r--r--drivers/scsi/leapraid/leapraid_func.c52
-rw-r--r--drivers/scsi/scsi_scan.c2
3 files changed, 23 insertions, 33 deletions
diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index 61f167e20..21b7e9666 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -767,7 +767,7 @@ static int fnic_nvmef_debugfs_open(struct inode *inode, struct file *file)
struct fnic_nvmef_info *info;
int buf_size = 2 * PAGE_SIZE;
- info = kzalloc_obj(struct fnic_nvmef_info, GFP_KERNEL);
+ info = kzalloc_obj(struct fnic_nvmef_info);
if (!info)
return -ENOMEM;
diff --git a/drivers/scsi/leapraid/leapraid_func.c b/drivers/scsi/leapraid/leapraid_func.c
index 089d0810b..66b43c1c7 100644
--- a/drivers/scsi/leapraid/leapraid_func.c
+++ b/drivers/scsi/leapraid/leapraid_func.c
@@ -2984,8 +2984,7 @@ static void leapraid_fw_evt_put(struct leapraid_fw_evt_work *fw_work)
static struct leapraid_fw_evt_work *leapraid_alloc_fw_evt_work(void)
{
- struct leapraid_fw_evt_work *fw_evt =
- kzalloc(sizeof(*fw_evt), GFP_ATOMIC);
+ struct leapraid_fw_evt_work *fw_evt = kzalloc_obj(*fw_evt, GFP_ATOMIC);
if (fw_evt)
kref_init(&fw_evt->refcnt);
@@ -3644,8 +3643,7 @@ static void leapraid_sas_host_add(struct leapraid_adapter *adapter,
return;
adapter->dev_topo.card.card_phy =
- kcalloc(phys_num,
- sizeof(struct leapraid_card_phy), GFP_KERNEL);
+ kzalloc_objs(struct leapraid_card_phy, phys_num);
if (!adapter->dev_topo.card.card_phy)
return;
@@ -3763,8 +3761,7 @@ static int leapraid_internal_exp_add(struct leapraid_adapter *adapter,
}
topo_node_exp->card_phy =
- kcalloc(topo_node_exp->phys_num,
- sizeof(struct leapraid_card_phy), GFP_KERNEL);
+ kzalloc_objs(struct leapraid_card_phy, topo_node_exp->phys_num);
if (!topo_node_exp->card_phy) {
dev_err(&adapter->pdev->dev,
"%s: Failed to alloc expander phy array, count=%u\n",
@@ -4352,7 +4349,7 @@ static void leapraid_sas_volume_add(
return;
}
- raid_volume = kzalloc(sizeof(*raid_volume), GFP_KERNEL);
+ raid_volume = kzalloc_obj(*raid_volume);
if (!raid_volume)
return;
@@ -6090,17 +6087,15 @@ static void leapraid_update_card_port_after_reset(
if (!adapter->dev_topo.card.card_phy) {
adapter->dev_topo.card.card_phy =
- kcalloc(nr_phys, sizeof(struct leapraid_card_phy),
- GFP_KERNEL);
+ kzalloc_objs(struct leapraid_card_phy, nr_phys);
if (!adapter->dev_topo.card.card_phy)
return;
}
adapter->dev_topo.card.phys_num = nr_phys;
- new_card_port_table = kcalloc(adapter->dev_topo.card.phys_num,
- sizeof(struct leapraid_card_port),
- GFP_KERNEL);
+ new_card_port_table = kzalloc_objs(struct leapraid_card_port,
+ adapter->dev_topo.card.phys_num);
if (!new_card_port_table)
return;
@@ -7224,8 +7219,8 @@ static int leapraid_set_legacy_int(struct leapraid_adapter *adapter)
adapter->notification_desc.iopoll_qdex,
adapter->notification_desc.iopoll_qcnt);
adapter->notification_desc.int_rqs =
- kcalloc(adapter->notification_desc.iopoll_qdex,
- sizeof(struct leapraid_int_rq), GFP_KERNEL);
+ kzalloc_objs(struct leapraid_int_rq,
+ adapter->notification_desc.iopoll_qdex);
if (!adapter->notification_desc.int_rqs)
return -ENOMEM;
@@ -7268,9 +7263,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter)
}
if (iopoll_qcnt) {
adapter->notification_desc.blk_mq_poll_rqs =
- kcalloc(iopoll_qcnt,
- sizeof(struct leapraid_blk_mq_poll_rq),
- GFP_KERNEL);
+ kzalloc_objs(struct leapraid_blk_mq_poll_rq,
+ iopoll_qcnt);
if (!adapter->notification_desc.blk_mq_poll_rqs)
return -ENOMEM;
adapter->adapter_attr.rq_cnt =
@@ -7289,8 +7283,8 @@ static int leapraid_set_msix(struct leapraid_adapter *adapter)
adapter->notification_desc.iopoll_qcnt);
adapter->notification_desc.int_rqs =
- kcalloc(adapter->notification_desc.iopoll_qdex,
- sizeof(struct leapraid_int_rq), GFP_KERNEL);
+ kzalloc_objs(struct leapraid_int_rq,
+ adapter->notification_desc.iopoll_qdex);
if (!adapter->notification_desc.int_rqs)
return -ENOMEM;
@@ -7365,9 +7359,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter)
if (iopoll_qcnt) {
adapter->notification_desc.blk_mq_poll_rqs =
- kcalloc(iopoll_qcnt,
- sizeof(struct leapraid_blk_mq_poll_rq),
- GFP_KERNEL);
+ kzalloc_objs(struct leapraid_blk_mq_poll_rq,
+ iopoll_qcnt);
if (!adapter->notification_desc.blk_mq_poll_rqs)
return -ENOMEM;
@@ -7404,9 +7397,8 @@ static int leapraid_set_msi(struct leapraid_adapter *adapter)
adapter->notification_desc.iopoll_qcnt);
adapter->notification_desc.int_rqs =
- kcalloc(adapter->notification_desc.iopoll_qdex,
- sizeof(struct leapraid_int_rq),
- GFP_KERNEL);
+ kzalloc_objs(struct leapraid_int_rq,
+ adapter->notification_desc.iopoll_qdex);
if (!adapter->notification_desc.int_rqs)
return -ENOMEM;
@@ -7958,18 +7950,16 @@ try_again:
DIV_ROUND_UP(adapter->adapter_attr.rq_cnt,
LEAPRAID_REP_DESC_CHUNK_SIZE);
adapter->mem_desc.rep_desc_seg_maint =
- kcalloc(adapter->adapter_attr.rep_desc_q_seg_cnt,
- sizeof(struct leapraid_rep_desc_seg_maint),
- GFP_KERNEL);
+ kzalloc_objs(struct leapraid_rep_desc_seg_maint,
+ adapter->adapter_attr.rep_desc_q_seg_cnt);
if (!adapter->mem_desc.rep_desc_seg_maint)
return -ENOMEM;
rep_desc_q_cnt_allocated = 0;
for (i = 0; i < adapter->adapter_attr.rep_desc_q_seg_cnt; i++) {
adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint =
- kcalloc(LEAPRAID_REP_DESC_CHUNK_SIZE,
- sizeof(struct leapraid_rep_desc_maint),
- GFP_KERNEL);
+ kzalloc_objs(struct leapraid_rep_desc_maint,
+ LEAPRAID_REP_DESC_CHUNK_SIZE);
if (!adapter->mem_desc.rep_desc_seg_maint[i].rep_desc_maint)
return -ENOMEM;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 3b82e80e8..0f0f243c2 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -158,7 +158,7 @@ int scsi_complete_async_scans(void)
* sleep a little. Even if we never get memory, the async
* scans will finish eventually.
*/
- data = kmalloc(sizeof(*data), GFP_KERNEL);
+ data = kmalloc_obj(*data);
if (!data)
msleep(1);
} while (!data);