From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9cRj-00026n-JJ for qemu-devel@nongnu.org; Tue, 22 Jul 2014 11:57:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X9cRe-0000EO-T1 for qemu-devel@nongnu.org; Tue, 22 Jul 2014 11:57:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X9cRe-0000EI-LL for qemu-devel@nongnu.org; Tue, 22 Jul 2014 11:57:38 -0400 Date: Tue, 22 Jul 2014 21:26:49 +0530 From: Amit Shah Message-ID: <20140722155649.GH32103@grmbl.mre> References: <1405979077-18163-1-git-send-email-jsnow@redhat.com> <20140722111617.GD18209@grmbl.mre> <877g35vcw8.fsf@blackfin.pond.sub.org> <20140722114850.GE18209@grmbl.mre> <53CE8394.6070101@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53CE8394.6070101@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] virtio-rng: Add human-readable error message for negative max-bytes parameter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: peter.maydell@linaro.org, Markus Armbruster , qemu-devel@nongnu.org On (Tue) 22 Jul 2014 [11:30:28], John Snow wrote: > > On 07/22/2014 07:48 AM, Amit Shah wrote: > >>>>- assert(vrng->conf.max_bytes <= INT64_MAX); > >>>>+ /* Workaround: Property parsing does not enforce unsigned integers, > >>>>+ * So this is a hack to reject such numbers. */ > >>>>+ if (vrng->conf.max_bytes > INT64_MAX) { > >>>>+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, "max-bytes", > >>>>+ "a non-negative integer below 2^63"); > >>>Huh, why do we allow 0? There's no reason to have 0 as a max-bytes > >>>value as well... > >>Could be treated as separate problem. > >Yep, don't mean to hold this up for that one. > > > >Thanks for the reviewed-by. > > Yes, 0 makes no sense, but there are a lot of extremely low values that > cause problems. 0 makes no sense, but other low values (even 1) is just a very frugal host admin trying to preserve his entropy pool. But for the guest, something is better than nothing. I don't see how such low values would cause problems. > The current release allows you to input 0 so I left it > as-is. Yes, the right thing to do for this patch. > The decision for what a reasonable minimum might be is perhaps up to > the user, unless a better technical limit is found (like 1K? 2K? 4K?) That's policy, and we should leave that to the admins. Amit