summaryrefslogtreecommitdiff
path: root/drivers/vhost
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 16:37:42 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 17:09:51 -0800
commitbf4afc53b77aeaa48b5409da5c8da6bb4eff7f43 (patch)
tree01fdd9d27f1b272bef0127966e08eac44d134d0a /drivers/vhost
parente19e1b480ac73c3e62ffebbca1174f0f511f43e7 (diff)
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/iotlb.c2
-rw-r--r--drivers/vhost/net.c6
-rw-r--r--drivers/vhost/scsi.c22
-rw-r--r--drivers/vhost/test.c4
-rw-r--r--drivers/vhost/vdpa.c8
-rw-r--r--drivers/vhost/vhost.c6
-rw-r--r--drivers/vhost/vsock.c2
7 files changed, 25 insertions, 25 deletions
diff --git a/drivers/vhost/iotlb.c b/drivers/vhost/iotlb.c
index 6528d084f42d..e1414c774c34 100644
--- a/drivers/vhost/iotlb.c
+++ b/drivers/vhost/iotlb.c
@@ -151,7 +151,7 @@ EXPORT_SYMBOL_GPL(vhost_iotlb_init);
*/
struct vhost_iotlb *vhost_iotlb_alloc(unsigned int limit, unsigned int flags)
{
- struct vhost_iotlb *iotlb = kzalloc_obj(*iotlb, GFP_KERNEL);
+ struct vhost_iotlb *iotlb = kzalloc_obj(*iotlb);
if (!iotlb)
return NULL;
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 440d959b6e24..9b2e888a533c 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -240,7 +240,7 @@ vhost_net_ubuf_alloc(struct vhost_virtqueue *vq, bool zcopy)
/* No zero copy backend? Nothing to count. */
if (!zcopy)
return NULL;
- ubufs = kmalloc_obj(*ubufs, GFP_KERNEL);
+ ubufs = kmalloc_obj(*ubufs);
if (!ubufs)
return ERR_PTR(-ENOMEM);
atomic_set(&ubufs->refcount, 1);
@@ -1330,7 +1330,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
n = kvmalloc_obj(*n, GFP_KERNEL | __GFP_RETRY_MAYFAIL);
if (!n)
return -ENOMEM;
- vqs = kmalloc_objs(*vqs, VHOST_NET_VQ_MAX, GFP_KERNEL);
+ vqs = kmalloc_objs(*vqs, VHOST_NET_VQ_MAX);
if (!vqs) {
kvfree(n);
return -ENOMEM;
@@ -1345,7 +1345,7 @@ static int vhost_net_open(struct inode *inode, struct file *f)
}
n->vqs[VHOST_NET_VQ_RX].rxq.queue = queue;
- xdp = kmalloc_objs(*xdp, VHOST_NET_BATCH, GFP_KERNEL);
+ xdp = kmalloc_objs(*xdp, VHOST_NET_BATCH);
if (!xdp) {
kfree(vqs);
kvfree(n);
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c
index 36ed704562d7..a3e7930e1ca5 100644
--- a/drivers/vhost/scsi.c
+++ b/drivers/vhost/scsi.c
@@ -548,7 +548,7 @@ vhost_scsi_allocate_evt(struct vhost_scsi *vs,
return NULL;
}
- evt = kzalloc_obj(*evt, GFP_KERNEL);
+ evt = kzalloc_obj(*evt);
if (!evt) {
vq_err(vq, "Failed to allocate vhost_scsi_evt\n");
vs->vs_events_missed = true;
@@ -896,7 +896,7 @@ vhost_scsi_copy_iov_to_sgl(struct vhost_scsi_cmd *cmd, struct iov_iter *iter,
int i, ret;
if (data_dir == DMA_FROM_DEVICE) {
- cmd->read_iter = kzalloc_obj(*cmd->read_iter, GFP_KERNEL);
+ cmd->read_iter = kzalloc_obj(*cmd->read_iter);
if (!cmd->read_iter)
return -ENOMEM;
@@ -1263,7 +1263,7 @@ vhost_scsi_setup_resp_iovs(struct vhost_scsi_cmd *cmd, struct iovec *in_iovs,
* iov per byte.
*/
cnt = min(VHOST_SCSI_MAX_RESP_IOVS, in_iovs_cnt);
- cmd->tvc_resp_iovs = kzalloc_objs(struct iovec, cnt, GFP_KERNEL);
+ cmd->tvc_resp_iovs = kzalloc_objs(struct iovec, cnt);
if (!cmd->tvc_resp_iovs)
return -ENOMEM;
@@ -1601,7 +1601,7 @@ vhost_scsi_handle_tmf(struct vhost_scsi *vs, struct vhost_scsi_tpg *tpg,
goto send_reject;
}
- tmf = kzalloc_obj(*tmf, GFP_KERNEL);
+ tmf = kzalloc_obj(*tmf);
if (!tmf)
goto send_reject;
@@ -1615,7 +1615,7 @@ vhost_scsi_handle_tmf(struct vhost_scsi *vs, struct vhost_scsi_tpg *tpg,
tmf->inflight = vhost_scsi_get_inflight(vq);
if (unlikely(log && log_num)) {
- tmf->tmf_log = kmalloc_objs(*tmf->tmf_log, log_num, GFP_KERNEL);
+ tmf->tmf_log = kmalloc_objs(*tmf->tmf_log, log_num);
if (tmf->tmf_log) {
memcpy(tmf->tmf_log, log, sizeof(*tmf->tmf_log) * log_num);
tmf->tmf_log_num = log_num;
@@ -1933,7 +1933,7 @@ static int vhost_scsi_setup_vq_cmds(struct vhost_virtqueue *vq, int max_cmds)
return -ENOMEM;
svq->max_cmds = max_cmds;
- svq->scsi_cmds = kzalloc_objs(*tv_cmd, max_cmds, GFP_KERNEL);
+ svq->scsi_cmds = kzalloc_objs(*tv_cmd, max_cmds);
if (!svq->scsi_cmds) {
sbitmap_free(&svq->scsi_tags);
return -ENOMEM;
@@ -2279,7 +2279,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
struct vhost_virtqueue **vqs;
int r = -ENOMEM, i, nvqs = vhost_scsi_max_io_vqs;
- vs = kvzalloc_obj(*vs, GFP_KERNEL);
+ vs = kvzalloc_obj(*vs);
if (!vs)
goto err_vs;
vs->inline_sg_cnt = vhost_scsi_inline_sg_cnt;
@@ -2303,7 +2303,7 @@ static int vhost_scsi_open(struct inode *inode, struct file *f)
if (!vs->vqs)
goto err_vqs;
- vqs = kmalloc_objs(*vqs, nvqs, GFP_KERNEL);
+ vqs = kmalloc_objs(*vqs, nvqs);
if (!vqs)
goto err_local_vqs;
@@ -2599,7 +2599,7 @@ static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg,
return -EEXIST;
}
- tv_nexus = kzalloc_obj(*tv_nexus, GFP_KERNEL);
+ tv_nexus = kzalloc_obj(*tv_nexus);
if (!tv_nexus) {
mutex_unlock(&tpg->tv_tpg_mutex);
pr_err("Unable to allocate struct vhost_scsi_nexus\n");
@@ -2794,7 +2794,7 @@ vhost_scsi_make_tpg(struct se_wwn *wwn, const char *name)
if (kstrtou16(name + 5, 10, &tpgt) || tpgt >= VHOST_SCSI_MAX_TARGET)
return ERR_PTR(-EINVAL);
- tpg = kzalloc_obj(*tpg, GFP_KERNEL);
+ tpg = kzalloc_obj(*tpg);
if (!tpg) {
pr_err("Unable to allocate struct vhost_scsi_tpg");
return ERR_PTR(-ENOMEM);
@@ -2848,7 +2848,7 @@ vhost_scsi_make_tport(struct target_fabric_configfs *tf,
/* if (vhost_scsi_parse_wwn(name, &wwpn, 1) < 0)
return ERR_PTR(-EINVAL); */
- tport = kzalloc_obj(*tport, GFP_KERNEL);
+ tport = kzalloc_obj(*tport);
if (!tport) {
pr_err("Unable to allocate struct vhost_scsi_tport");
return ERR_PTR(-ENOMEM);
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
index fc11a048a620..24514c8fdee4 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -110,13 +110,13 @@ static void handle_vq_kick(struct vhost_work *work)
static int vhost_test_open(struct inode *inode, struct file *f)
{
- struct vhost_test *n = kmalloc_obj(*n, GFP_KERNEL);
+ struct vhost_test *n = kmalloc_obj(*n);
struct vhost_dev *dev;
struct vhost_virtqueue **vqs;
if (!n)
return -ENOMEM;
- vqs = kmalloc_objs(*vqs, VHOST_TEST_VQ_MAX, GFP_KERNEL);
+ vqs = kmalloc_objs(*vqs, VHOST_TEST_VQ_MAX);
if (!vqs) {
kfree(n);
return -ENOMEM;
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index a9f85f05874f..692564b1bcbb 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -110,7 +110,7 @@ static struct vhost_vdpa_as *vhost_vdpa_alloc_as(struct vhost_vdpa *v, u32 asid)
if (asid >= v->vdpa->nas)
return NULL;
- as = kmalloc_obj(*as, GFP_KERNEL);
+ as = kmalloc_obj(*as);
if (!as)
return NULL;
@@ -1064,7 +1064,7 @@ static int vhost_vdpa_va_map(struct vhost_vdpa *v,
!(vma->vm_flags & (VM_IO | VM_PFNMAP))))
goto next;
- map_file = kzalloc_obj(*map_file, GFP_KERNEL);
+ map_file = kzalloc_obj(*map_file);
if (!map_file) {
ret = -ENOMEM;
break;
@@ -1420,7 +1420,7 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
if (r)
goto err;
- vqs = kmalloc_objs(*vqs, nvqs, GFP_KERNEL);
+ vqs = kmalloc_objs(*vqs, nvqs);
if (!vqs) {
r = -ENOMEM;
goto err;
@@ -1593,7 +1593,7 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa)
v->dev.release = vhost_vdpa_release_dev;
v->dev.parent = &vdpa->dev;
v->dev.devt = MKDEV(MAJOR(vhost_vdpa_major), minor);
- v->vqs = kmalloc_objs(struct vhost_virtqueue, v->nvqs, GFP_KERNEL);
+ v->vqs = kmalloc_objs(struct vhost_virtqueue, v->nvqs);
if (!v->vqs) {
r = -ENOMEM;
goto err;
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index dafbc3dd3805..7260cdb92716 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -516,8 +516,8 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
vq = dev->vqs[i];
vq->indirect = kmalloc_objs(*vq->indirect, UIO_MAXIOV,
GFP_KERNEL);
- vq->log = kmalloc_objs(*vq->log, dev->iov_limit, GFP_KERNEL);
- vq->heads = kmalloc_objs(*vq->heads, dev->iov_limit, GFP_KERNEL);
+ vq->log = kmalloc_objs(*vq->log, dev->iov_limit);
+ vq->heads = kmalloc_objs(*vq->heads, dev->iov_limit);
vq->nheads = kmalloc_array(dev->iov_limit, sizeof(*vq->nheads),
GFP_KERNEL);
if (!vq->indirect || !vq->log || !vq->heads || !vq->nheads)
@@ -3268,7 +3268,7 @@ EXPORT_SYMBOL_GPL(vhost_disable_notify);
struct vhost_msg_node *vhost_new_msg(struct vhost_virtqueue *vq, int type)
{
/* Make sure all padding within the structure is initialized. */
- struct vhost_msg_node *node = kzalloc_obj(*node, GFP_KERNEL);
+ struct vhost_msg_node *node = kzalloc_obj(*node);
if (!node)
return NULL;
diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
index 0bb4e3fdc71c..054f7a718f50 100644
--- a/drivers/vhost/vsock.c
+++ b/drivers/vhost/vsock.c
@@ -680,7 +680,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file)
if (!vsock)
return -ENOMEM;
- vqs = kmalloc_objs(*vqs, ARRAY_SIZE(vsock->vqs), GFP_KERNEL);
+ vqs = kmalloc_objs(*vqs, ARRAY_SIZE(vsock->vqs));
if (!vqs) {
ret = -ENOMEM;
goto out;