search for: einval

Displaying 20 results from an estimated 4434 matches for "einval".

2020 Sep 04
0
[libnbd PATCH 1/2] api: Add nbd_set_strict_mode
...+ * Copyright (C) 2013-2020 Red Hat Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,9 +29,11 @@ int nbd_unlocked_shutdown (struct nbd_handle *h, uint32_t flags) { - if (flags != 0) { - set_error (EINVAL, "invalid flag: %" PRIu32, flags); - return -1; + if (h->strict & LIBNBD_STRICT_COMMANDS) { + if (flags != 0) { + set_error (EINVAL, "invalid flag: %" PRIu32, flags); + return -1; + } } if (!h->disconnect_request && @@ -55,9 +57,11 @@...
2020 Sep 04
4
[RFC libnbd PATCH 0/2] Add knobs for client- vs. server-side validation
We have been inconsistent on how much we reject client-side without even consulting the server, vs. how much we depend on the server to detect failure (even if our request can be deemed undefined per NBD protocol). I'd like to change it so that by default, we reject as much as we can client-side for less traffic, but where the user can also change things on the fly for server-side integration
2017 Jul 17
2
[PATCH] drm/nouveau/hwmon: Uninitialized variables in sysfs
kstrtol() and friends can return -EINVAL or -ERANGE. We have to test for both, otherwise the value is possibly uninitialized. Also in some of these files we accidentally return "count" on error instead of a negative error code. Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com> diff --git a/drivers/gpu/drm/nouv...
2019 Jun 18
1
[PATCH] hwmon: return EINVAL if the GPU is powered down for sensors reads
...80..d445c6f3f 100644 --- a/drm/nouveau/nouveau_hwmon.c +++ b/drm/nouveau/nouveau_hwmon.c @@ -426,6 +426,8 @@ nouveau_temp_read(struct device *dev, u32 attr, int channel, long *val) switch (attr) { case hwmon_temp_input: + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) + return -EINVAL; ret = nvkm_therm_temp_get(therm); *val = ret < 0 ? ret : (ret * 1000); break; @@ -472,6 +474,8 @@ nouveau_fan_read(struct device *dev, u32 attr, int channel, long *val) switch (attr) { case hwmon_fan_input: + if (drm_dev->switch_power_state != DRM_SWITCH_POWER_ON) + return...
2020 Sep 04
0
[libnbd PATCH 2/2] api: Add STRICT_BOUNDS to nbd_set_strict_mode
...>state = STATE_START; diff --git a/lib/rw.c b/lib/rw.c index b5c1698..adfb7ac 100644 --- a/lib/rw.c +++ b/lib/rw.c @@ -278,6 +278,18 @@ nbd_unlocked_aio_pread (struct nbd_handle *h, void *buf, } } + if (h->strict & LIBNBD_STRICT_BOUNDS) { + if (count == 0) { + set_error (EINVAL, "count cannot be 0"); + return -1; + } + + if (offset > h->exportsize || offset + count > h->exportsize) { + set_error (EINVAL, "request out of bounds"); + return -1; + } + } + return nbd_internal_command_common (h, 0, NBD_CMD_READ, offse...
2017 Nov 15
1
[nbdkit PATCH] connections: Improve error responses
We had several inconsistencies from the NBD spec when diagnosing bad client messages: - FLUSH is not generally forbidden on a read-only export (so failing with EPERM is wrong) [meanwhile, if we don't advertise flush because plugin_can_flush() fails, then rejecting with EINVAL is still okay] - returning EPERM (aka EROFS) for read-only exports should probably take precedence over anything else - out-of-bounds WRITE and WRITE_ZEROES should fail with ENOSPC, not EIO - out-of-bounds READ and TRIM should fail with EINVAL, not EIO We also had dead code: valid_range() and vali...
2020 Aug 31
1
[PATCH v2] nouveau: fix the start/end range for migration
...m; args->va_start &= PAGE_MASK; - args->va_end &= PAGE_MASK; + args->va_end = ALIGN(args->va_end, PAGE_SIZE); /* Sanity check arguments */ if (args->reserved0 || args->reserved1) @@ -118,8 +118,6 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, return -EINVAL; if (args->va_start >= args->va_end) return -EINVAL; - if (!args->npages) - return -EINVAL; cmd = args->header >> NOUVEAU_SVM_BIND_COMMAND_SHIFT; cmd &= NOUVEAU_SVM_BIND_COMMAND_MASK; @@ -151,12 +149,6 @@ nouveau_svmm_bind(struct drm_device *dev, void *data, i...
2013 Mar 02
1
[PATCH] btrfs: return EPERM in btrfs_rm_device()
Currently there are error paths in btrfs_rm_device() where EINVAL is returned telling the user they passed an invalid argument even though they passed a valid device. Change to return EPERM instead as the operation is not permitted. Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com> --- fs/btrfs/volumes.c | 8 ++++---- 1 file changed, 4 inserti...
2019 Aug 30
0
[nbdkit PATCH 9/9] server: Move command validation from protocol.c to backend.c
...*conn, void *handle) { @@ -283,6 +320,10 @@ backend_pread (struct backend *b, struct connection *conn, debug ("%s: pread count=%" PRIu32 " offset=%" PRIu64, b->name, count, offset); + if (invalid_range (b, conn, "pread", offset, count)) { + *err = EINVAL; + return -1; + } r = b->pread (b, conn, buf, count, offset, flags, err); if (r == -1) assert (*err); @@ -300,6 +341,14 @@ backend_pwrite (struct backend *b, struct connection *conn, debug ("%s: pwrite count=%" PRIu32 " offset=%" PRIu64 " fua=%d",...
2014 Apr 18
3
[PATCH] virtio_net: zero is an invald queue_pairs number
Execute "ethtool -L eth0 combined 0" in guest, if multiqueue is enabled, virtnet_send_command() will return -EINVAL error, there is a validation in QEMU. But if multiqueue is disabled, virtnet_set_queues() will just return zero (success). We should return error for this situation. Signed-off-by: Amos Kong <akong at redhat.com> --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deleti...
2014 Apr 18
3
[PATCH] virtio_net: zero is an invald queue_pairs number
Execute "ethtool -L eth0 combined 0" in guest, if multiqueue is enabled, virtnet_send_command() will return -EINVAL error, there is a validation in QEMU. But if multiqueue is disabled, virtnet_set_queues() will just return zero (success). We should return error for this situation. Signed-off-by: Amos Kong <akong at redhat.com> --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deleti...
2003 Apr 05
1
Weird EINVAL readig *large* file
...4.3-STABLE to 4.7p4 and at the same time reorganizing my vinum volumes I copied several (unmounted) vinum volumes (ufs filesystems) to a large IDE disk using dd(1) in order to be able to recreate my vinum volumes. When I try to read back one of the saved images containing a 16GB filesystem, I get EINVAL somewhere half way the file. I first discoverd this when I tried "sum /dev/vinum/arch" but this happens with every command I use to read the file, even with a small C program I wrote to just read the file in 8KB chunks to verify this error. The read(2) manual page gives the following exp...
2019 Jul 03
0
[RFC v2] vhost: introduce mdev based hardware vhost backend
...vfio_op *op = NULL; > + loff_t pos = *ppos; > + loff_t offset; > + int ret; > + > + vdpa = mdev_get_drvdata(mdev); > + if (!vdpa) { > + ret = -ENODEV; > + goto out; > + } > + > + offset = VDPA_VFIO_VHOST_REGION_OFFSET(pos); > + if (offset != 0) { > + ret = -EINVAL; > + goto out; > + } > + > + if (!vdpa->pending_reply) { > + ret = 0; > + goto out; > + } > + > + vdpa->pending_reply = false; > + > + op = kzalloc(VHOST_VFIO_OP_HDR_SIZE + VHOST_VFIO_OP_PAYLOAD_MAX_SIZE, > + GFP_KERNEL); > + if (op == NULL) { &...
2019 Jul 03
4
[RFC v2] vhost: introduce mdev based hardware vhost backend
...count, loff_t *ppos) +{ + struct vdpa_dev *vdpa; + struct vhost_vfio_op *op = NULL; + loff_t pos = *ppos; + loff_t offset; + int ret; + + vdpa = mdev_get_drvdata(mdev); + if (!vdpa) { + ret = -ENODEV; + goto out; + } + + offset = VDPA_VFIO_VHOST_REGION_OFFSET(pos); + if (offset != 0) { + ret = -EINVAL; + goto out; + } + + if (!vdpa->pending_reply) { + ret = 0; + goto out; + } + + vdpa->pending_reply = false; + + op = kzalloc(VHOST_VFIO_OP_HDR_SIZE + VHOST_VFIO_OP_PAYLOAD_MAX_SIZE, + GFP_KERNEL); + if (op == NULL) { + ret = -ENOMEM; + goto out; + } + + op->request = vdpa->p...
2019 Jul 03
4
[RFC v2] vhost: introduce mdev based hardware vhost backend
...count, loff_t *ppos) +{ + struct vdpa_dev *vdpa; + struct vhost_vfio_op *op = NULL; + loff_t pos = *ppos; + loff_t offset; + int ret; + + vdpa = mdev_get_drvdata(mdev); + if (!vdpa) { + ret = -ENODEV; + goto out; + } + + offset = VDPA_VFIO_VHOST_REGION_OFFSET(pos); + if (offset != 0) { + ret = -EINVAL; + goto out; + } + + if (!vdpa->pending_reply) { + ret = 0; + goto out; + } + + vdpa->pending_reply = false; + + op = kzalloc(VHOST_VFIO_OP_HDR_SIZE + VHOST_VFIO_OP_PAYLOAD_MAX_SIZE, + GFP_KERNEL); + if (op == NULL) { + ret = -ENOMEM; + goto out; + } + + op->request = vdpa->p...
2020 Jun 03
1
[PATCH RFC 01/13] vhost: option to fetch descriptors through an independent struct
...gt; + if (unlikely(len % sizeof desc)) { >>> + vq_err(vq, "Invalid length in indirect descriptor: " >>> + "len 0x%llx not multiple of 0x%zx\n", >>> + (unsigned long long)len, >>> + sizeof desc); >>> + return -EINVAL; >>> + } >>> + >>> + ret = translate_desc(vq, indirect->addr, len, vq->indirect, >>> + UIO_MAXIOV, VHOST_ACCESS_RO); >>> + if (unlikely(ret < 0)) { >>> + if (ret != -EAGAIN) >>> + vq_err(vq, "Translation failure...
2013 Jul 19
0
[PATCH] xen: replace strict_strtoul() with kstrtoul()
...t store_selfballooning(struct device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - err = strict_strtoul(buf, 10, &tmp); - if (err || ((tmp != 0) && (tmp != 1))) + err = kstrtoul(buf, 10, &tmp); + if (err) + return err; + if ((tmp != 0) && (tmp != 1)) return -EINVAL; xen_selfballooning_enabled = !!tmp; @@ -292,8 +294,10 @@ static ssize_t store_selfballoon_interval(struct device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - err = strict_strtoul(buf, 10, &val); - if (err || val == 0) + err = kstrtoul(buf, 10, &val); + if (err) + return...
2013 Jul 19
0
[PATCH] xen: replace strict_strtoul() with kstrtoul()
...t store_selfballooning(struct device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - err = strict_strtoul(buf, 10, &tmp); - if (err || ((tmp != 0) && (tmp != 1))) + err = kstrtoul(buf, 10, &tmp); + if (err) + return err; + if ((tmp != 0) && (tmp != 1)) return -EINVAL; xen_selfballooning_enabled = !!tmp; @@ -292,8 +294,10 @@ static ssize_t store_selfballoon_interval(struct device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - err = strict_strtoul(buf, 10, &val); - if (err || val == 0) + err = kstrtoul(buf, 10, &val); + if (err) + return...
2013 Jul 19
0
[PATCH] xen: replace strict_strtoul() with kstrtoul()
...t store_selfballooning(struct device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - err = strict_strtoul(buf, 10, &tmp); - if (err || ((tmp != 0) && (tmp != 1))) + err = kstrtoul(buf, 10, &tmp); + if (err) + return err; + if ((tmp != 0) && (tmp != 1)) return -EINVAL; xen_selfballooning_enabled = !!tmp; @@ -292,8 +294,10 @@ static ssize_t store_selfballoon_interval(struct device *dev, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - err = strict_strtoul(buf, 10, &val); - if (err || val == 0) + err = kstrtoul(buf, 10, &val); + if (err) + return...
2020 Oct 09
3
Re: [PATCH v3 8/8] lib/canonical-name.c: Hide EINVAL error from underlying API call.
...important as well? The only one I can find it the file not existing, but it means this function might fail without an error message if I understand it correctly. > ret = guestfs_lvm_canonical_lv_name (g, device); >- if (ret == NULL) >+ guestfs_pop_error_handler (g); >+ /* EINVAL is expected if the device is somelike a LUKS- or >+ * BitLocker-encrypted volume, so simply return the original >+ * name in that case. >+ */ >+ if (ret == NULL && guestfs_last_errno (g) == EINVAL) > ret = safe_strdup (g, device); > } > else &gt...