From nobody Sat Apr 27 23:00:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495800169510241.19058834796772; Fri, 26 May 2017 05:02:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C24197F7C5; Fri, 26 May 2017 12:02:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59AA182784; Fri, 26 May 2017 12:02:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0ACBC97018; Fri, 26 May 2017 12:02:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4QC2RAM009815 for ; Fri, 26 May 2017 08:02:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3FD8480681; Fri, 26 May 2017 12:02:27 +0000 (UTC) Received: from moo.home.annexia.org (unknown [10.36.118.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9A477FB73; Fri, 26 May 2017 12:02:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C24197F7C5 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C24197F7C5 From: "Richard W.M. Jones" To: libvir-list@redhat.com Date: Fri, 26 May 2017 13:02:15 +0100 Message-Id: <20170526120215.29984-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH] rpc: Double buffer size instead of quadrupling buffer size. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 26 May 2017 12:02:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 When increasing the buffer size up to VIR_NET_MESSAGE_MAX, we currently quadruple it each time. This unfortunately means that we cannot allow certain buffer sizes -- for example the current VIR_NET_MESSAGE_MAX =3D=3D 33554432 can never be "hit" since =E2=80=98newle= n=E2=80=99 jumps from 16MB to 64MB. Instead of quadrupling, double it each time. Thanks: Daniel Berrange. --- src/rpc/virnetmessage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c index c3a2e595c..5908b074a 100644 --- a/src/rpc/virnetmessage.c +++ b/src/rpc/virnetmessage.c @@ -358,7 +358,8 @@ int virNetMessageEncodePayload(virNetMessagePtr msg, =20 /* Try to encode the payload. If the buffer is too small increase it. = */ while (!(*filter)(&xdr, data, 0)) { - unsigned int newlen =3D (msg->bufferLength - VIR_NET_MESSAGE_LEN_M= AX) * 4; + unsigned int newlen =3D msg->bufferLength - VIR_NET_MESSAGE_LEN_MA= X; + newlen *=3D 2; =20 if (newlen > VIR_NET_MESSAGE_MAX) { virReportError(VIR_ERR_RPC, "%s", _("Unable to encode message = payload")); --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list