From nobody Sun Sep 28 16:36:40 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1756728624; cv=none; d=zohomail.com; s=zohoarc; b=e/60Oo0RanWtAV+14ie3dYLahAUux4PLt3QOKW+Qab7WDOEsm8J2NcJPT7ccfyYp7Fzv45lNpNyJ5J5cjGApts+nG7DqiXQ9H0E9etmokcwDRqg3gY1gZ19NAmwciKeBf/nexukWYRlw9g2IKBFpCQjq8jk+dJiYeEn630VREQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756728624; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Date:Resent-To:References:Resent-Message-ID:Resent-From:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=os84wrbCKE8S3rpPjh53xN3q5M0Jv9m6MCnVR8nrjUA=; b=mACWP1Bj95IHp2v17D344lny1beqiCX0Vl2HY650AwSANR4xgbXCmBDZoSSo2JjDSGCB/gvsbcVMo7QYBw5+siG7HKQ6rBw00C8e4uEBVp7FkRC2jjklrNRlP4a+znRFqBkWoF9TZYWO3dpGLU9jhsybQeAwKZ+ueNlEk2kjWHE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1756728624478894.5850707588943; Mon, 1 Sep 2025 05:10:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ut3LA-0006AD-Nj; Mon, 01 Sep 2025 08:08:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ut3L6-00064q-Nh for qemu-devel@nongnu.org; Mon, 01 Sep 2025 08:08:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ut3Ku-0005eo-Tt for qemu-devel@nongnu.org; Mon, 01 Sep 2025 08:08:48 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-130-EzAoKK4hPXaNdnhg7ceK0g-1; Mon, 01 Sep 2025 08:08:28 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6377519560B3; Mon, 1 Sep 2025 12:08:27 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.18]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D67DC1955EA4; Mon, 1 Sep 2025 12:08:26 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 0DEA621E6924; Mon, 01 Sep 2025 14:08:24 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9878E21E6924; Mon, 01 Sep 2025 13:19:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756728509; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-to: resent-from:resent-message-id:in-reply-to:in-reply-to: references:references; bh=os84wrbCKE8S3rpPjh53xN3q5M0Jv9m6MCnVR8nrjUA=; b=NFqZ2dZscpUhtPvPPaRUG25kLYfFguSqsJKzgCYWgMZXfkZQJUEJh3MD8SO3cOodgUixbl 4Kd23jt8rGee12k8eqr8pLp2C9cqFiePsoJIfJeqRvUqm9MOuwDXtwmjIH1gx3jagYWNKa VURGOTWKJ3s4HP/WzClhsPAi4ypdZa8= X-MC-Unique: EzAoKK4hPXaNdnhg7ceK0g-1 X-Mimecast-MFC-AGG-ID: EzAoKK4hPXaNdnhg7ceK0g_1756728507 Resent-To: qemu-devel@nongnu.org, richard.henderson@linaro.org Resent-From: Markus Armbruster Resent-Date: Mon, 01 Sep 2025 14:08:23 +0200 Resent-Message-ID: <87tt1m4bpk.fsf@pond.sub.org> X-From-Line: armbru@redhat.com Mon Sep 1 13:19:06 2025 X-Original-To: armbru From: Markus Armbruster To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 1/3] ui/keymaps: Avoid trace crash and improve error messages Date: Mon, 1 Sep 2025 13:19:04 +0200 Message-ID: <20250901111906.2403307-2-armbru@redhat.com> In-Reply-To: <20250901111906.2403307-1-armbru@redhat.com> References: <20250901111906.2403307-1-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Lines: 55 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1756728626888124100 parse_keyboard_layout() passes a possibly null @filename to trace_keymap_parse(). Trace backend log then formats it with %s, which crashes on some systems. Fix by moving the null check before the trace_keymap_parse(). While there, improve the error messages a bit. Fixes: d3b787fa7dde (keymaps: add tracing) Signed-off-by: Markus Armbruster Message-ID: <20250723131504.1482657-1-armbru@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- ui/keymaps.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/keymaps.c b/ui/keymaps.c index 6ceaa97085..2359dbfe7e 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -86,19 +86,25 @@ static int parse_keyboard_layout(kbd_layout_t *k, const name2keysym_t *table, const char *language, Error **errp) { + g_autofree char *filename =3D NULL; int ret; FILE *f; - char * filename; char line[1024]; char keyname[64]; int len; =20 filename =3D qemu_find_file(QEMU_FILE_TYPE_KEYMAP, language); + if (!filename) { + error_setg(errp, "could not find keymap file for language '%s'", + language); + return -1; + } + trace_keymap_parse(filename); - f =3D filename ? fopen(filename, "r") : NULL; - g_free(filename); + + f =3D fopen(filename, "r"); if (!f) { - error_setg(errp, "could not read keymap file: '%s'", language); + error_setg_file_open(errp, errno, filename); return -1; } =20 --=20 2.49.0