From nobody Tue Nov 18 16:52:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611665149; cv=none; d=zohomail.com; s=zohoarc; b=W1Nw22NoZOmZ81g+MjjRlTg3AF7Q+Xc1yQ9KDk0INb9FjqQVAJgF8IIU8s96ZtCuTJLMPQFAkmGmYrK6VPaHut1J5YyEhATd5mcIIKh9WJOirWkleNY40+YHdMojX14F4x9S9UTI78Xvjs7WAcyuHUR9YyyZy75K4jv3x3RAX9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611665149; h=Content-Type:Content-Transfer-Encoding:Cc: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=Se3HBlmEVDTc8dgcbM4AZOzs4tqtqBD0FvgAXCbGgBc=; b=Vtcd3XBa6KvnnROowAQWbNSXExwVYlD8Qxw1A1fNPlOW5gwJ15TgACLtrzu/NPs/MUYoNjb9jReLsTU2fOJEv6OhuwyGheGP1/RwV4XeED8BSCzgjIYx5u95vuNLBG5YSej/JJ776wJb2offAv+/dp1Fh66l48uXdZQX1QL/5js= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611665149012173.8518922479176; Tue, 26 Jan 2021 04:45:49 -0800 (PST) Received: from localhost ([::1]:42534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4Nj9-0003VB-Ux for importer@patchew.org; Tue, 26 Jan 2021 07:45:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53548) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4NgS-00027o-JV for qemu-devel@nongnu.org; Tue, 26 Jan 2021 07:43:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:35508) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l4NgN-00041P-Mu for qemu-devel@nongnu.org; Tue, 26 Jan 2021 07:43:00 -0500 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-150-jXXYmJWpM6yUgtmADNCLrw-1; Tue, 26 Jan 2021 07:42:51 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7491915721 for ; Tue, 26 Jan 2021 12:42:50 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-224.ams2.redhat.com [10.36.113.224]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D34CB60C62; Tue, 26 Jan 2021 12:42:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 65693113861E; Tue, 26 Jan 2021 13:42:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611664973; 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: in-reply-to:in-reply-to:references:references; bh=Se3HBlmEVDTc8dgcbM4AZOzs4tqtqBD0FvgAXCbGgBc=; b=GLanu7o7kCrtSgb5DDRiq64P7KyhXhm10CWhICunipE/2k6WNfcWfQi7YGIO3Iuanm44F7 Ea9neupQHA6qcWnJLFAYZKpnw/7DQVV90/kHHS+4Yy3iW+Od/8+e0f562bNA2X+dCBAFdN TAVENZlluTFJMU17tOUqtTnMO273IX4= X-MC-Unique: jXXYmJWpM6yUgtmADNCLrw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 1/2] backends/dbus-vmstate: Fix short read error handling Date: Tue, 26 Jan 2021 13:42:39 +0100 Message-Id: <20210126124240.2081959-2-armbru@redhat.com> In-Reply-To: <20210126124240.2081959-1-armbru@redhat.com> References: <20210126124240.2081959-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=63.128.21.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.255, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, kraxel@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When dbus_vmstate_post_load() fails, it complains to stderr. Except on short read, where it checks with g_return_val_if_fail(). This fails silently if G_DISABLE_CHECKS is undefined (it should be), or else pads the short read with uninitialized bytes. Replace g_return_val_if_fail() by a proper error check. Fixes: 5010cec2bc87dafab39b3913c8ca91f88df9c540 Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau --- backends/dbus-vmstate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backends/dbus-vmstate.c b/backends/dbus-vmstate.c index bd050e8e9c..2a0d2e4a31 100644 --- a/backends/dbus-vmstate.c +++ b/backends/dbus-vmstate.c @@ -229,7 +229,10 @@ static int dbus_vmstate_post_load(void *opaque, int ve= rsion_id) &bytes_read, NULL, &err)) { goto error; } - g_return_val_if_fail(bytes_read =3D=3D len, -1); + if (bytes_read !=3D len) { + error_report("%s: Short read", __func__); + return -1; + } id[len] =3D 0; =20 trace_dbus_vmstate_loading(id); --=20 2.26.2 From nobody Tue Nov 18 16:52:50 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611665272; cv=none; d=zohomail.com; s=zohoarc; b=L6VqCZCcTgvW7x0SZCcLRPTvkZ3sdbZIE2hn4S0SuzbaFHW7k2f/731pyb8azNX4Zwq2m/sbZyE3SkIryg2ZUqE3KYzyH3k5nrEClY9a5PH8YyRibn7Yr5kEgERZDtgIdExufCakDlTX/B7BwDs0I9FaMomz2wcV8m5VChwkdbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611665272; h=Content-Type:Content-Transfer-Encoding:Cc: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=ZWfk6qDo8lFbWommcIWgL4G0uENb9iJFYUYGrjCN+1o=; b=nQwOeUOan4q/QVlIxN3sm1M+6RGUkfc90dJ0WJ9O3FyU4isNkMk0Pdz06aVUEx2LxJ5IUXqYjT39pBHMjX5UowrfwH52A8I5wrSwuT80/K58bPZ1fG7aDuGehH5iXZdAYr1ADwexb8zQ974dVPfcATWl+bkNmZnsDKZWZwTNlho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611665272430885.0391768044346; Tue, 26 Jan 2021 04:47:52 -0800 (PST) Received: from localhost ([::1]:46876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4Nl9-0005YK-G4 for importer@patchew.org; Tue, 26 Jan 2021 07:47:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4NgT-00028A-5M for qemu-devel@nongnu.org; Tue, 26 Jan 2021 07:43:01 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57455) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l4NgQ-00041O-DI for qemu-devel@nongnu.org; Tue, 26 Jan 2021 07:43:00 -0500 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-289-Yudo0ORgNqSCWr_9bIGsGw-1; Tue, 26 Jan 2021 07:42:51 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73CDE107ACE3 for ; Tue, 26 Jan 2021 12:42:50 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-113-224.ams2.redhat.com [10.36.113.224]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6FC160C64; Tue, 26 Jan 2021 12:42:41 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6849B1138461; Tue, 26 Jan 2021 13:42:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611664973; 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: in-reply-to:in-reply-to:references:references; bh=ZWfk6qDo8lFbWommcIWgL4G0uENb9iJFYUYGrjCN+1o=; b=DUSJP9y8w8mFqT+5fRwbBCmLkAJzotLOTUDknUydmKYhjGT7LwOZiGYcQclSewZGYqn90T +AjJD5xFYLOE290yJau5yfxkuc/NWut+mX9w3Y+0gkcrVEV/PJycptRxVinX1Zp5S9Znq3 y7vKtVUrvrWQGUfh1x/jfhFcbz5WLis= X-MC-Unique: Yudo0ORgNqSCWr_9bIGsGw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH 2/2] vhost_user_gpu: Drop dead check for g_malloc() failure Date: Tue, 26 Jan 2021 13:42:40 +0100 Message-Id: <20210126124240.2081959-3-armbru@redhat.com> In-Reply-To: <20210126124240.2081959-1-armbru@redhat.com> References: <20210126124240.2081959-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=216.205.24.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.255, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: marcandre.lureau@redhat.com, kraxel@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Michael S. Tsirkin --- hw/display/vhost-user-gpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 51f1747c4a..db042c7c5e 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -332,7 +332,6 @@ vhost_user_gpu_chr_read(void *opaque) } =20 msg =3D g_malloc(VHOST_USER_GPU_HDR_SIZE + size); - g_return_if_fail(msg !=3D NULL); =20 r =3D qemu_chr_fe_read_all(&g->vhost_chr, (uint8_t *)&msg->payload, size); --=20 2.26.2