Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread Markus Armbruster
John Snow js...@redhat.com writes: On 07/18/2014 09:16 AM, Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:54:01], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread Markus Armbruster
John Snow js...@redhat.com writes: On 07/18/2014 09:16 AM, Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:54:01], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread John Snow
On 07/21/2014 03:48 AM, Markus Armbruster wrote: It certainly could check whether the value fits into uint64_t. A quick peek at how string-input-visitor.c uses strtoll() makes me cringe. [...] What I meant by that was to say that by the time a value was returned to visit_type_uint64, the

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread Markus Armbruster
John Snow js...@redhat.com writes: On 07/21/2014 03:48 AM, Markus Armbruster wrote: It certainly could check whether the value fits into uint64_t. A quick peek at how string-input-visitor.c uses strtoll() makes me cringe. [...] What I meant by that was to say that by the time a value

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread John Snow
On 07/21/2014 01:33 PM, Markus Armbruster wrote: John Snow js...@redhat.com writes: On 07/21/2014 03:48 AM, Markus Armbruster wrote: It certainly could check whether the value fits into uint64_t. A quick peek at how string-input-visitor.c uses strtoll() makes me cringe. [...] What I meant

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread Markus Armbruster
John Snow js...@redhat.com writes: On 07/21/2014 01:33 PM, Markus Armbruster wrote: John Snow js...@redhat.com writes: On 07/21/2014 03:48 AM, Markus Armbruster wrote: It certainly could check whether the value fits into uint64_t. A quick peek at how string-input-visitor.c uses strtoll()

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread John Snow
On 07/21/2014 03:15 PM, Markus Armbruster wrote: John Snow js...@redhat.com writes: On 07/21/2014 01:33 PM, Markus Armbruster wrote: John Snow js...@redhat.com writes: On 07/21/2014 03:48 AM, Markus Armbruster wrote: It certainly could check whether the value fits into uint64_t. A quick

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-21 Thread Eric Blake
On 07/21/2014 02:13 PM, John Snow wrote: I can certainly grep through the code to find out who is using unsigned properties. In the case of uint32, -1 I believe will already wrap around but then overflow (because we parse as uint64_t) and throw an error, so I don't expect we will see anyone

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Amit Shah
On (Fri) 18 Jul 2014 [08:27:59], Markus Armbruster wrote: John Snow js...@redhat.com writes: If a negative integer is used for the max_bytes parameter, QEMU currently calls abort() and leaves behind a core dump. This patch adds a simple error message to make the reason for the termination

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Markus Armbruster
Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [08:27:59], Markus Armbruster wrote: John Snow js...@redhat.com writes: If a negative integer is used for the max_bytes parameter, QEMU currently calls abort() and leaves behind a core dump. This patch adds a simple error

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Amit Shah
On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [08:27:59], Markus Armbruster wrote: John Snow js...@redhat.com writes: If a negative integer is used for the max_bytes parameter, QEMU currently calls abort() and

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Markus Armbruster
Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [08:27:59], Markus Armbruster wrote: John Snow js...@redhat.com writes: If a negative integer is used for the max_bytes

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Amit Shah
On (Fri) 18 Jul 2014 [13:54:01], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [08:27:59], Markus Armbruster wrote: John Snow js...@redhat.com

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Markus Armbruster
Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:54:01], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [08:27:59], Markus Armbruster

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread John Snow
On 07/18/2014 09:16 AM, Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:54:01], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On (Fri) 18 Jul 2014 [13:15:18], Markus Armbruster wrote: Amit Shah amit.s...@redhat.com writes: On

Re: [Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-18 Thread Eric Blake
On 07/18/2014 03:14 PM, John Snow wrote: visit_type_uint32 has a boundary check where it makes sure that the value given to it is within its range, though it will still convert negatives automatically and depending on the negative given, it might pass this range check. visit_type_uint64 by

[Qemu-devel] [PATCH v2] virtio-rng: Add human-readable error message for negative max-bytes parameter

2014-07-17 Thread John Snow
If a negative integer is used for the max_bytes parameter, QEMU currently calls abort() and leaves behind a core dump. This patch adds a simple error message to make the reason for the termination clearer. Signed-off-by: John Snow js...@redhat.com --- v2: Changed 0L constant to (uint64_t)0