search for: kcalloc

Displaying 20 results from an estimated 264 matches for "kcalloc".

Did you mean: calloc
2024 Mar 06
1
[PATCH v3] nouveau/dmem: handle kcalloc() allocation failure
The kcalloc() in nouveau_dmem_evict_chunk() will return null if the physical memory has run out. As a result, if we dereference src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs will happen. Moreover, the GPU is going away. If the kcalloc() fails, we could not evict all pages mapping a chunk....
2024 Mar 08
0
[PATCH v3] nouveau/dmem: handle kcalloc() allocation failure
On 3/6/24 06:01, Duoming Zhou wrote: > The kcalloc() in nouveau_dmem_evict_chunk() will return null if > the physical memory has run out. As a result, if we dereference > src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs > will happen. > > Moreover, the GPU is going away. If the kcalloc() fails, we could not > ev...
2024 Mar 03
1
[PATCH] nouveau/dmem: handle kcalloc() allocation failure
The kcalloc() in nouveau_dmem_evict_chunk() will return null if the physical memory has run out. As a result, if we dereference src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs will happen. This patch uses stack variables to replace the kcalloc(). Fixes: 249881232e14 ("nouveau/dmem: ev...
2024 Mar 04
1
[PATCH] nouveau/dmem: handle kcalloc() allocation failure
On Sun, Mar 3, 2024 at 4:46?AM Duoming Zhou <duoming at zju.edu.cn> wrote: > > The kcalloc() in nouveau_dmem_evict_chunk() will return null if > the physical memory has run out. As a result, if we dereference > src_pfns, dst_pfns or dma_addrs, the null pointer dereference bugs > will happen. > > This patch uses stack variables to replace the kcalloc(). Won't this blow...
2017 Jan 26
0
[PATCH 1/3] virtio_pci: Use kcalloc() in vp_request_msix_vectors()
From: Markus Elfring <elfring at users.sourceforge.net> Date: Thu, 26 Jan 2017 22:10:18 +0100 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus reuse the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring at users.sourceforge.net> --- drivers/virtio/virtio_pci_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/v...
2020 Sep 24
0
[PATCH 3/8] vhost scsi: alloc cmds per vq instead of session
...md *tv_cmd; > + unsigned int i; > + > + if (svq->scsi_cmds) > + return 0; > + > + if (sbitmap_init_node(&svq->scsi_tags, max_cmds, -1, GFP_KERNEL, > + NUMA_NO_NODE)) > + return -ENOMEM; > + svq->max_cmds = max_cmds; > + > + svq->scsi_cmds = kcalloc(max_cmds, sizeof(*tv_cmd), GFP_KERNEL); > + if (!svq->scsi_cmds) { > + sbitmap_free(&svq->scsi_tags); > + return -ENOMEM; > + } > + > + for (i = 0; i < max_cmds; i++) { > + tv_cmd = &svq->scsi_cmds[i]; > + > + tv_cmd->tvc_sgl = kcalloc(VHOST_SCS...
2019 Nov 29
0
[PATCH] nouveau: fix incorrect sizeof on args.src an args.dst
.../drivers/gpu/drm/nouveau/nouveau_dmem.c index fa1439941596..0ad5d87b5a8e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -635,10 +635,10 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, unsigned long c, i; int ret = -ENOMEM; - args.src = kcalloc(max, sizeof(args.src), GFP_KERNEL); + args.src = kcalloc(max, sizeof(*args.src), GFP_KERNEL); if (!args.src) goto out; - args.dst = kcalloc(max, sizeof(args.dst), GFP_KERNEL); + args.dst = kcalloc(max, sizeof(*args.dst), GFP_KERNEL); if (!args.dst) goto out_free_src; -- 2.24.0
2020 Feb 14
0
[PATCH AUTOSEL 5.5 074/542] drm/nouveau/nouveau: fix incorrect sizeof on args.src an args.dst
...rivers/gpu/drm/nouveau/nouveau_dmem.c index fa14399415965..0ad5d87b5a8e5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -635,10 +635,10 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, unsigned long c, i; int ret = -ENOMEM; - args.src = kcalloc(max, sizeof(args.src), GFP_KERNEL); + args.src = kcalloc(max, sizeof(*args.src), GFP_KERNEL); if (!args.src) goto out; - args.dst = kcalloc(max, sizeof(args.dst), GFP_KERNEL); + args.dst = kcalloc(max, sizeof(*args.dst), GFP_KERNEL); if (!args.dst) goto out_free_src; -- 2.20.1
2020 Feb 14
0
[PATCH AUTOSEL 5.4 065/459] drm/nouveau/nouveau: fix incorrect sizeof on args.src an args.dst
...rivers/gpu/drm/nouveau/nouveau_dmem.c index fa14399415965..0ad5d87b5a8e5 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c @@ -635,10 +635,10 @@ nouveau_dmem_migrate_vma(struct nouveau_drm *drm, unsigned long c, i; int ret = -ENOMEM; - args.src = kcalloc(max, sizeof(args.src), GFP_KERNEL); + args.src = kcalloc(max, sizeof(*args.src), GFP_KERNEL); if (!args.src) goto out; - args.dst = kcalloc(max, sizeof(args.dst), GFP_KERNEL); + args.dst = kcalloc(max, sizeof(*args.dst), GFP_KERNEL); if (!args.dst) goto out_free_src; -- 2.20.1
2017 Jan 26
4
[PATCH 0/3] Virtio: Fine-tuning for two function implementations
From: Markus Elfring <elfring at users.sourceforge.net> Date: Thu, 26 Jan 2017 22:40:02 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): virtio_pci: Use kcalloc() in vp_request_msix_vectors() virtio_pci: Use kmalloc_array() in vp_request_msix_vectors() virtio_ring: Use kmalloc_array() in alloc_indirect() drivers/virtio/virtio_pci_common.c | 8 ++++---- drivers/virtio/virtio_ring.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) -- 2...
2017 Jan 26
4
[PATCH 0/3] Virtio: Fine-tuning for two function implementations
From: Markus Elfring <elfring at users.sourceforge.net> Date: Thu, 26 Jan 2017 22:40:02 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): virtio_pci: Use kcalloc() in vp_request_msix_vectors() virtio_pci: Use kmalloc_array() in vp_request_msix_vectors() virtio_ring: Use kmalloc_array() in alloc_indirect() drivers/virtio/virtio_pci_common.c | 8 ++++---- drivers/virtio/virtio_ring.c | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) -- 2...
2007 Oct 12
1
Asus P5B-VM DO board?
...s/2.6.9-55.0.9.EL-smp-x86_64' CC [M] /root/intel/drm/linux-core/drm_agpsupport.o In file included from /root/intel/drm/linux-core/drmP.h:168, from /root/intel/drm/linux-core/drm_agpsupport.c:34: /root/intel/drm/linux-core/drm_compat.h:114: warning: static declaration of 'kcalloc' follows non-static declaration include/linux/slab.h:103: warning: previous declaration of 'kcalloc' was here /root/intel/drm/linux-core/drm_agpsupport.c: In function `drm_agp_populate': /root/intel/drm/linux-core/drm_agpsupport.c:531: warning: implicit declaration of function `phys...
2012 Nov 02
4
[PATCH] ACPI/cpuidle: remove unused "power" field from Cx state data
It has never been used for anything, and Linux 3.7 doesn''t propagate this information anymore. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- Konrad, on the pv-ops side it may be better to pass zero rather than leaving the field completely uninitialized. --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -935,7 +935,6 @@ static void set_cx( }
2013 Mar 05
4
[RFC PATCH] drm/nouveau: use vmalloc for pgt allocation
...v/vm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c @@ -362,7 +362,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, vm->fpde = offset >> (vmm->pgt_bits + 12); vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); - vm->pgt = kcalloc(vm->lpde - vm->fpde + 1, sizeof(*vm->pgt), GFP_KERNEL); + vm->pgt = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt)); if (!vm->pgt) { kfree(vm); return -ENOMEM; @@ -371,7 +371,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, ret = nou...
2017 Aug 03
1
[PATCH v13 5/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
> > On 08/03/2017 04:13 PM, Pankaj Gupta wrote: > >> > >> + /* Allocate space for find_vqs parameters */ > >> + vqs = kcalloc(nvqs, sizeof(*vqs), GFP_KERNEL); > >> + if (!vqs) > >> + goto err_vq; > >> + callbacks = kmalloc_array(nvqs, sizeof(*callbacks), GFP_KERNEL); > >> + if (!callbacks) > >> + goto err_callback; > >&gt...
2018 Nov 28
0
[PATCH 6/6] drm/qxl: use qxl_num_crtc directly
...IN_VRAM, @@ -1170,9 +1168,8 @@ int qxl_create_monitors_object(struct qxl_device *qdev) qxl_bo_physical_address(qdev, qdev->monitors_config_bo, 0); memset(qdev->monitors_config, 0, monitors_config_size); - qdev->monitors_config->max_allowed = max_allowed; - - qdev->dumb_heads = kcalloc(max_allowed, sizeof(qdev->dumb_heads[0]), GFP_KERNEL); + qdev->dumb_heads = kcalloc(qxl_num_crtc, sizeof(qdev->dumb_heads[0]), + GFP_KERNEL); return 0; } -- 2.9.3
2018 Dec 28
0
[PATCH v1 1/2] virtio_pci: use queue idx instead of array idx to set up the vq
...i_common.c @@ -285,7 +285,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, { struct virtio_pci_device *vp_dev = to_vp_device(vdev); u16 msix_vec; - int i, err, nvectors, allocated_vectors; + int i, err, nvectors, allocated_vectors, queue_idx = 0; vp_dev->vqs = kcalloc(nvqs, sizeof(*vp_dev->vqs), GFP_KERNEL); if (!vp_dev->vqs) @@ -321,7 +321,7 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned nvqs, msix_vec = allocated_vectors++; else msix_vec = VP_MSIX_VQ_VECTOR; - vqs[i] = vp_setup_vq(vdev, i, callbacks[i], names[i], + vqs...
2017 Aug 03
1
[PATCH v13 5/5] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ
> > On 08/03/2017 04:13 PM, Pankaj Gupta wrote: > >> > >> + /* Allocate space for find_vqs parameters */ > >> + vqs = kcalloc(nvqs, sizeof(*vqs), GFP_KERNEL); > >> + if (!vqs) > >> + goto err_vq; > >> + callbacks = kmalloc_array(nvqs, sizeof(*callbacks), GFP_KERNEL); > >> + if (!callbacks) > >> + goto err_callback; > >&gt...
2011 Nov 04
1
[patch 1/2] xen-gntalloc: integer overflow in gntalloc_ioctl_alloc()
...s/xen/gntalloc.c index f6832f4..23c60cf 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -280,7 +280,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, goto out; } - gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY); + gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY); if (!gref_ids) { rc = -ENOMEM; goto out;
2011 Nov 04
1
[patch 1/2] xen-gntalloc: integer overflow in gntalloc_ioctl_alloc()
...s/xen/gntalloc.c index f6832f4..23c60cf 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -280,7 +280,7 @@ static long gntalloc_ioctl_alloc(struct gntalloc_file_private_data *priv, goto out; } - gref_ids = kzalloc(sizeof(gref_ids[0]) * op.count, GFP_TEMPORARY); + gref_ids = kcalloc(op.count, sizeof(gref_ids[0]), GFP_TEMPORARY); if (!gref_ids) { rc = -ENOMEM; goto out;