From nobody Mon Feb 9 17:07:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614698510; cv=none; d=zohomail.com; s=zohoarc; b=cYnpq/Er3JwQ7rdPEGg8EM3Kl9gUPVd4sVvWa3vYtylNi7yQEThlGqkMDi+ar1AxoZILJUzVr3V2y5Myh/1svFYemv4+yuL9B/j3wnTzslxNsjBNhhb9wfN4Vntkm0lycjz5i9R7Hmo3PXDRs4qWSJrcT5Vsp95y/owd1vvkA/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614698510; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OlEtWJJ5CCj+tX/vUkYgSGlS2e9DSd+YBaeFpPFKZN0=; b=IhSHtJ0WPIjuXRcEYCsXLgmfzyMGiBxRMqpLyJ4TywlgxsPq/42BuXc3wCo8ccUeGcu78NVTd0TZ9mDH7dM9aBszvztLoheV2eTZVy8mP3NwMsY4AUjg1iqt/S0chdFbgqse/vbNovdMWn66Ec/qEJqp714Wdp7IvwrdYrCD064= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1614698510895577.60007664535; Tue, 2 Mar 2021 07:21:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-lvrMDjP2P9-URc5NbXuEtg-1; Tue, 02 Mar 2021 10:21:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1B40E5769; Tue, 2 Mar 2021 15:21:38 +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 A36F419C48; Tue, 2 Mar 2021 15:21:38 +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 650304E58D; Tue, 2 Mar 2021 15:21:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 122FLI66017550 for ; Tue, 2 Mar 2021 10:21:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6357C19C46; Tue, 2 Mar 2021 15:21:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8BFFE144 for ; Tue, 2 Mar 2021 15:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614698509; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OlEtWJJ5CCj+tX/vUkYgSGlS2e9DSd+YBaeFpPFKZN0=; b=d4UnCZ16jEK47YnWByZKBBr4a+ZE0laHvLPQdWCwocnii2fZNs0Kfl03dy/PRj5xqB6lo2 RsPetw+E2UF3g1TzYQRZJ+VGZ9mGu0Z9WmQ61qJ850PtLDue4Ck3cxXoUjRiX7YiSOzlM/ 86h2Zo5vcLUfHTYG8vrPN2IKGKdYgrM= X-MC-Unique: lvrMDjP2P9-URc5NbXuEtg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] qemuProcessReportLogError: Remove unnecessary math for max error message Date: Tue, 2 Mar 2021 16:21:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that error message formatting doesn't use fixed size buffers we can drop the math for calculating the maximum chunk of log to report in the error message and use a round number. This also makes it obvious that the chosen number is arbitrary. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 398f63282e..55649286ae 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2140,14 +2140,9 @@ qemuProcessReportLogError(qemuDomainLogContextPtr lo= gCtxt, const char *msgprefix) { g_autofree char *logmsg =3D NULL; - size_t max; - max =3D VIR_ERROR_MAX_LENGTH - 1; - max -=3D strlen(msgprefix); - /* The length of the formatting string minus two '%s' */ - max -=3D strlen(_("%s: %s")) - 4; - - if (qemuProcessReadLog(logCtxt, &logmsg, max) < 0) + /* assume that 1024 chars of qemu log is the right balance */ + if (qemuProcessReadLog(logCtxt, &logmsg, 1024) < 0) return -1; virResetLastError(); --=20 2.29.2