Displaying 20 results from an estimated 1100 matches for "err_ptr".
2015 Jul 15
2
[patch] vhost: NULL vs ERR_PTR bug
There is only one caller for vhost_kvzalloc() and it expects NULL on
allocation failure. Most people would probably expect that so let's
change ERR_PTR(-ENOMEM) to NULL.
Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a9fe859..99d613b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/...
2015 Jul 15
2
[patch] vhost: NULL vs ERR_PTR bug
There is only one caller for vhost_kvzalloc() and it expects NULL on
allocation failure. Most people would probably expect that so let's
change ERR_PTR(-ENOMEM) to NULL.
Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index a9fe859..99d613b 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/...
2010 Oct 30
0
[PATCH] Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...)) - generated by Coccinelle
This patch was generated using the Coccinelle scripts and btrfs
code in v2.6.36-9657-g7a3f8fe.
Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
The semantic patch that makes this change is available
in scripts/coccinelle/api/err_cast.cocci.
More information about semantic patching is available at
http://coccinelle.lip6.fr/
Signed-off-by: Chris Samuel <chris@csamuel.org>
diff --git a/fs/btrfs/extent_map.c b/fs/b...
2023 Nov 07
3
[bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
...he patch 176fdcbddfd2: "drm/nouveau/gsp/r535: add support for
booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the
following Smatch static checker warning:
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 r535_gsp_rpc_unloading_guest_driver()
warn: 'rpc' isn't an ERR_PTR
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
1010 static int
1011 r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend)
1012 {
1013 rpc_unloading_guest_driver_v1F_07 *rpc;
1014
1015 rpc = nvkm_gsp_rpc_get(gsp, NV_VGPU_MSG_FUNCTION_UNLOAD...
2023 Mar 07
3
[PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check
...git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index 9e496e288cfa..3d7144f8f959 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -306,10 +306,10 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
return ERR_PTR(-EINVAL);
/* Check if queue is either not available or already active. */
- num = vp_modern_get_queue_size(mdev, index);
- if (!num || vp_modern_get_queue_enable(mdev, index))
+ if (vp_modern_get_queue_enable(mdev, index))
return ERR_PTR(-ENOENT);
+ num = vp_modern_get_queue_size(mdev, ind...
2015 Jul 15
3
[patch] vhost: NULL vs ERR_PTR bug
Am 15.07.2015 13:28, schrieb Michael S. Tsirkin:
> On Wed, Jul 15, 2015 at 02:16:59PM +0300, Dan Carpenter wrote:
>> There is only one caller for vhost_kvzalloc() and it expects NULL on
>> allocation failure. Most people would probably expect that so let's
>> change ERR_PTR(-ENOMEM) to NULL.
>>
>> Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
>> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
>
> Ouch. Thanks a lot for noticing this, and it's a good thing
> you did before Linus merge...
2015 Jul 15
3
[patch] vhost: NULL vs ERR_PTR bug
Am 15.07.2015 13:28, schrieb Michael S. Tsirkin:
> On Wed, Jul 15, 2015 at 02:16:59PM +0300, Dan Carpenter wrote:
>> There is only one caller for vhost_kvzalloc() and it expects NULL on
>> allocation failure. Most people would probably expect that so let's
>> change ERR_PTR(-ENOMEM) to NULL.
>>
>> Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
>> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
>
> Ouch. Thanks a lot for noticing this, and it's a good thing
> you did before Linus merge...
2023 Nov 07
1
[bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
...add support for
>> booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the
>> following Smatch static checker warning:
>>
>> ????drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 r535_gsp_rpc_unloading_guest_driver()
>> ????warn: 'rpc' isn't an ERR_PTR
>>
>> drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
>> ???? 1010 static int
>> ???? 1011 r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend)
>> ???? 1012 {
>> ???? 1013???????? rpc_unloading_guest_driver_v1F_07 *rpc;
>> ???? 1014
>&g...
2019 Jun 26
1
[PATCH 15/25] memremap: provide an optional internal refcount in struct dev_pagemap
..._memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
> break;
> }
>
> - if (!pgmap->ref || !pgmap->ops || !pgmap->ops->kill ||
> - !pgmap->ops->cleanup) {
> - WARN(1, "Missing reference count teardown definition\n");
> - return ERR_PTR(-EINVAL);
> + if (!pgmap->ref) {
> + if (pgmap->ops && (pgmap->ops->kill || pgmap->ops->cleanup))
> + return ERR_PTR(-EINVAL);
> +
> + init_completion(&pgmap->done);
> + error = percpu_ref_init(&pgmap->internal_ref,
> + dev_pagema...
2015 Jul 15
0
[patch] vhost: NULL vs ERR_PTR bug
On Wed, Jul 15, 2015 at 02:16:59PM +0300, Dan Carpenter wrote:
> There is only one caller for vhost_kvzalloc() and it expects NULL on
> allocation failure. Most people would probably expect that so let's
> change ERR_PTR(-ENOMEM) to NULL.
>
> Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
Ouch. Thanks a lot for noticing this, and it's a good thing
you did before Linus merged it.
I'll squash this...
2015 Jul 15
0
[patch] vhost: NULL vs ERR_PTR bug
...13:28, schrieb Michael S. Tsirkin:
> > On Wed, Jul 15, 2015 at 02:16:59PM +0300, Dan Carpenter wrote:
> >> There is only one caller for vhost_kvzalloc() and it expects NULL on
> >> allocation failure. Most people would probably expect that so let's
> >> change ERR_PTR(-ENOMEM) to NULL.
> >>
> >> Fixes: 4de7255f7d2b ('vhost: extend memory regions allocation to vmalloc')
> >> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
> >
> > Ouch. Thanks a lot for noticing this, and it's a good thing
> &g...
2019 Jun 26
0
[PATCH 15/25] memremap: provide an optional internal refcount in struct dev_pagemap
...ut
@@ -175,10 +202,21 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
break;
}
- if (!pgmap->ref || !pgmap->ops || !pgmap->ops->kill ||
- !pgmap->ops->cleanup) {
- WARN(1, "Missing reference count teardown definition\n");
- return ERR_PTR(-EINVAL);
+ if (!pgmap->ref) {
+ if (pgmap->ops && (pgmap->ops->kill || pgmap->ops->cleanup))
+ return ERR_PTR(-EINVAL);
+
+ init_completion(&pgmap->done);
+ error = percpu_ref_init(&pgmap->internal_ref,
+ dev_pagemap_percpu_release, 0, GFP_KERNEL);
+...
2023 Nov 07
2
[bug report] drm/nouveau/gsp/r535: add support for booting GSP-RM
...uot;drm/nouveau/gsp/r535: add support for
> booting GSP-RM" from Sep 19, 2023 (linux-next), leads to the
> following Smatch static checker warning:
>
> drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1016 r535_gsp_rpc_unloading_guest_driver()
> warn: 'rpc' isn't an ERR_PTR
>
> drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c
> 1010 static int
> 1011 r535_gsp_rpc_unloading_guest_driver(struct nvkm_gsp *gsp, bool suspend)
> 1012 {
> 1013 rpc_unloading_guest_driver_v1F_07 *rpc;
> 1014
> 1015 rpc = nvkm...
2023 Mar 08
1
[PATCH 1/3] virtio_pci_modern: Remove unnecessary num zero check
....c b/drivers/virtio/virtio_pci_modern.c
> index 9e496e288cfa..3d7144f8f959 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -306,10 +306,10 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
> return ERR_PTR(-EINVAL);
>
> /* Check if queue is either not available or already active. */
> - num = vp_modern_get_queue_size(mdev, index);
> - if (!num || vp_modern_get_queue_enable(mdev, index))
> + if (vp_modern_get_queue_enable(mdev, index))
> retu...
2020 Aug 11
3
[PATCH] drm/nouveau/gem: Use vmemdup_user() rather than duplicating its implementation
...ivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -587,15 +587,9 @@ u_memcpya(uint64_t user, unsigned nmemb, unsigned size)
void __user *userptr = (void __force __user *)(uintptr_t)user;
size *= nmemb;
-
- mem = kvmalloc(size, GFP_KERNEL);
- if (!mem)
- return ERR_PTR(-ENOMEM);
-
- if (copy_from_user(mem, userptr, size)) {
- u_free(mem);
- return ERR_PTR(-EFAULT);
- }
+ mem = vmemdup_user(userptr, size);
+ if (IS_ERR(mem))
+ return ERR_PTR(PTR_ERR(mem));
return mem;
}
--
2.28.0
2024 May 09
0
[PATCH v4] drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations
...o.family >= NV_DEVICE_INFO_V0_FERMI) {
> - nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
> - if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
> - kfree(nvbo);
> - return ERR_PTR(-EINVAL);
> - }
>
> - nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;
> - } else if (cli->device.info.family >=
> NV_DEVICE_INFO_V0_TESLA) {
> - nvbo->kind = (tile_flags & 0x...
2014 Dec 08
0
[PATCH v2 06/10] virtio_pci: setup vqs indirectly
...irtio_pci_vq_info *info;
struct virtqueue *vq;
- unsigned long flags, size;
+ unsigned long size;
u16 num;
int err;
@@ -409,28 +415,21 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
if (!num || ioread32(vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN))
return ERR_PTR(-ENOENT);
- /* allocate and fill out our structure the represents an active
- * queue */
- info = kmalloc(sizeof(struct virtio_pci_vq_info), GFP_KERNEL);
- if (!info)
- return ERR_PTR(-ENOMEM);
-
info->num = num;
info->msix_vector = msix_vec;
size = PAGE_ALIGN(vring_size(num, VIRT...
2014 Dec 08
0
[PATCH v2 06/10] virtio_pci: setup vqs indirectly
...irtio_pci_vq_info *info;
struct virtqueue *vq;
- unsigned long flags, size;
+ unsigned long size;
u16 num;
int err;
@@ -409,28 +415,21 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
if (!num || ioread32(vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN))
return ERR_PTR(-ENOENT);
- /* allocate and fill out our structure the represents an active
- * queue */
- info = kmalloc(sizeof(struct virtio_pci_vq_info), GFP_KERNEL);
- if (!info)
- return ERR_PTR(-ENOMEM);
-
info->num = num;
info->msix_vector = msix_vec;
size = PAGE_ALIGN(vring_size(num, VIRT...
2024 May 08
0
[PATCH v3] drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations
...o.family >= NV_DEVICE_INFO_V0_FERMI) {
> - nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
> - if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
> - kfree(nvbo);
> - return ERR_PTR(-EINVAL);
> - }
>
> - nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;
> - } else if (cli->device.info.family >=
> NV_DEVICE_INFO_V0_TESLA) {
> - nvbo->kind = (tile_flags & 0x...
2023 Aug 14
2
[PATCH] drm/nouveau/disp: fix use-after-free in error handling of nouveau_connector_create
...drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -1408,8 +1408,7 @@ nouveau_connector_create(struct drm_device *dev,
ret = nvif_conn_ctor(&disp->disp, nv_connector->base.name, nv_connector->index,
&nv_connector->conn);
if (ret) {
- kfree(nv_connector);
- return ERR_PTR(ret);
+ goto drm_conn_err;
}
ret = nvif_conn_event_ctor(&nv_connector->conn, "kmsHotplug",
@@ -1426,8 +1425,7 @@ nouveau_connector_create(struct drm_device *dev,
if (ret) {
nvif_event_dtor(&nv_connector->hpd);
nvif_conn_dtor(&nv_connector->conn...