From nobody Sat Nov 23 18:20:54 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934046; cv=none; d=zohomail.com; s=zohoarc; b=fGovgZqwjjT9NmQZwG9c/ltdVo6NtNjU4tF+cE5TKmFv04vhD2jo1WvHYAcXaSXgh7rkM7wwT84KtOyrMZr75Rb7q6X10f8KofrqX4UDrcjpuURfjmlh+KaVf9Xx7WJc7YIAuv9GG37nJT1lKx5WgenjMCwJoQRZFdNA6cxY/7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934046; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T83eivt/vSoGlflCpjNelp/9rr9ILqKefhCT6i7Xuwg=; b=A43KNwQHkic9qQv4rb3sjeVC/GTlJeSPF4ljYtRc8bGEvnCi4OYnW+N4hGFGsS4eh/0dCVJnyratTSdAKGQdZg70fytgmRfQGp0t0sS6QFQ5yYRAGzzfiKFD0Y+nkJSx7J5qUuNbPUGsC2V+kx1X9DCoVEY0i/CYY+HHSCoJWDo= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934046140878.2048567451571; Mon, 18 Nov 2024 04:47:26 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD19f-0002xl-Sj; Mon, 18 Nov 2024 07:46:59 -0500 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 1tD19a-0002wr-Mq for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:46:55 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19Z-0005N2-7P for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:46:54 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-38241435528so937771f8f.2 for ; Mon, 18 Nov 2024 04:46:52 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da298760sm157802675e9.37.2024.11.18.04.46.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:46:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934011; x=1732538811; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T83eivt/vSoGlflCpjNelp/9rr9ILqKefhCT6i7Xuwg=; b=ZDe7FS/m7dVGLzDVi9InQBFshmcSamru3ErZviG0TX+0DWPpJxvu9MCHPq4+OcZm65 mBsZKm9T/5I1j0/9f9HKC+blNbWX4QfJa0dD3cLuts6l70PTtV2rurEZ7I8uyKws/QCm qTp4Gt+yCV3GOia42C//U6eqE5tDdnb8UxqOcdxBCt2mOcKhOSjcXI2OFzx4NNEotrK8 iwFdQ6U3u45MdB3LxnL7balTUy/gw5jgnE288uJHipy0iQpV+02pxxl517MNPblg+X8h yCtkQNEpxosrlk11CcC9f3Fdo2t5VmK5PVAlaGNzytfkW3KBzAReUZ1QZreyUBaonQ9w l4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934011; x=1732538811; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T83eivt/vSoGlflCpjNelp/9rr9ILqKefhCT6i7Xuwg=; b=lziW4dptPTUtOiZVFXJtD3Hw0XTWGzqWW5imPIvKWmJrLVEMZiLD1vHzevFu/E3Iu2 IBs1OZClP+r6XvoAlAX7InxQcR9rB1yCATYcc3e1T/O2QziKkmDMsBQB0KSYOyxDkGMc aBiev/hjZoiDYJaHMfsNgLI4w7fcny3mwiVlIdHGPJ9s+b4yzAcFdRWmSHTmGVr21bYi F4JGAI5xnQvYX3WQhO8vjs2vwrcOv5J65wCRxWAWf/tlSRml9AqJVD47d/DaWI0U9ehJ 9UMpo+iUurckgwlk3xBsLV3p0YsixRPLH3bP7nRxJrXNdk6rLTLIZDOWkrQL5k6KzNUx hJHg== X-Gm-Message-State: AOJu0YyMrI2cO23Wix3XE6gAXKX5m3ekJVIW/Xf6bkwDGP8vMTbm5/e1 f7P2q3ZI3GuQqQKefxGJ8JA+AkfSdXNrrF+l84P7IEb7eZF9qF9/0f7wtqIDGTCiNMgfllk8mbC m X-Google-Smtp-Source: AGHT+IEm84lNylibTJlCyQB8g1q4Y2jIYuREQNmC4L9EW4l3v/2lIyiLpTrL01g6xiV5R056sQxmRw== X-Received: by 2002:a05:6000:782:b0:381:f595:fd0a with SMTP id ffacd0b85a97d-38225907a2amr9456944f8f.16.1731934011413; Mon, 18 Nov 2024 04:46:51 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/15] vl: fix qemu_validate_options() indention Date: Mon, 18 Nov 2024 13:46:28 +0100 Message-ID: <20241118124643.6958-2-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934046455116600 From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240905141211.1253307-2-kraxel@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- system/vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/system/vl.c b/system/vl.c index d217b3d64d..3bb8f2db9a 100644 --- a/system/vl.c +++ b/system/vl.c @@ -2427,15 +2427,15 @@ static void qemu_validate_options(const QDict *mach= ine_opts) const char *kernel_cmdline =3D qdict_get_try_str(machine_opts, "append= "); =20 if (kernel_filename =3D=3D NULL) { - if (kernel_cmdline !=3D NULL) { - error_report("-append only allowed with -kernel option"); - exit(1); - } + if (kernel_cmdline !=3D NULL) { + error_report("-append only allowed with -kernel option"); + exit(1); + } =20 - if (initrd_filename !=3D NULL) { - error_report("-initrd only allowed with -kernel option"); - exit(1); - } + if (initrd_filename !=3D NULL) { + error_report("-initrd only allowed with -kernel option"); + exit(1); + } } =20 if (loadvm && incoming) { --=20 2.45.2 From nobody Sat Nov 23 18:20:54 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934033; cv=none; d=zohomail.com; s=zohoarc; b=QNbYOlmcFal6bgffmpdZjlZHDz+FL44o/y7fv8+a/lyASYTulVzR/OaLQ1uEut/nyW98WvfaZDKcsNZxbmJAt4qOBFJESYl1SeX2a1VdBb+ZzJnFnr1x5hRPkLATCIm7sFTLYVBAeG2imKsOp2T5qpS+JGaZIszrvMZMjoIoms8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934033; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SYaQEXuNR5+lHEU/8nCGWk7gVy7qrMgUNRPmBIpU6l0=; b=RHtb+4/88pBIyTResf4cFPdqBcARLNNbL7l+bO9cpvCpnvkFHDeRS0S+g40zCZSasU9WJceJXl4/4endtMXgXsel+hW2OMd9kwOPmgpGEnKdjwvs08Fnagy3vU+CWioMYeFcn/5l3PM2nkB9m5sdjnrGRuPN5DXuA37P34E0z/0= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934033225827.6217244116463; Mon, 18 Nov 2024 04:47:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD19h-0002y5-T2; Mon, 18 Nov 2024 07:47:01 -0500 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 1tD19g-0002xv-Q6 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:00 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19f-0005NO-1f for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:00 -0500 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3824709ee03so651954f8f.2 for ; Mon, 18 Nov 2024 04:46:58 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3823d253773sm5992907f8f.36.2024.11.18.04.46.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:46:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934017; x=1732538817; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SYaQEXuNR5+lHEU/8nCGWk7gVy7qrMgUNRPmBIpU6l0=; b=OQO2a5SAdBdsaCE8oBcaWZ9Qz3Okoqm9VRw+ZB5IRJvvrRY+67j0fBWiNgoeLRGjcu TKbIBs3bmM/ExMXXeF5v0hesqVCHOf+Yh6MHqiNlg7hK0gw5AppC8e9aai9sRGmocLoI WP3/yHdaMFQnRUf1BIk438xJiF9NS+MwAX8de6qnFbOvZBfCI9BE6EBWsVxa+mNV3zGK NvG6x8/FnYs+sGMGsg72NmjApuqhBSlR4lfFtvJl/R+sG3D213O07pPX0AS7gRpy66EY dQnhaqgzJz38EGHlR5DG1X2ohtmu0HuQTZI2OjrswiyP/nPQvjCqtVZskkbjBVVc8vD8 n1lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934017; x=1732538817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SYaQEXuNR5+lHEU/8nCGWk7gVy7qrMgUNRPmBIpU6l0=; b=t9Ee243pmeVRddzxNaVHgOOxPI8MjgCNZN3X/PAFVyqW8DbfSUl2joBKL7Yb+4Q+zI VAMWDm9f6hKYf+VpSoKqfF7tx6vPQAyq4FmOf/G6Eu88/Fq4KxpITZDyCf2/bjRORbkK pv0HWRqdjd0eS5LjA+iDE+ZZ2EjDNjUm6vqEik/4z1dro9pZn1U6KVEvJWcCpGmtWD3d 6yKQ42oWXl6r//OlgPHU7xAZe+bWAdbrPtBxIMy8ke/tORfgkN3KSQ60P5ueS2u4x38r fcnba2hA6ULmpkSPNuwi5hGlnH3cwyp+eivfVjEl/cWpenilqmAw8u7gASa8rdUNTaHI GyqA== X-Gm-Message-State: AOJu0Yw342X5CLgrhjo/Rm69Z1D1yvp/tF9kQdDqUzyl5Q1C8OKoFkfs KgFGcsf8h6VmxcMZfyVnh6aSUFkHmhGvRxFWjJY1R7Fg0y/Ew7KMyEbF9M9ogGf4xTUOTw94rN/ V X-Google-Smtp-Source: AGHT+IGNdfeakP6/JxfeWYZ6+tFEh9hd1Ly4sN2R3qZr8tsW51LVZL6nKb6s+0mud0XEVGF1s3/YNQ== X-Received: by 2002:a05:6000:188f:b0:382:450c:25ee with SMTP id ffacd0b85a97d-382450c2aa8mr3968418f8f.40.1731934017117; Mon, 18 Nov 2024 04:46:57 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 02/15] hw/misc/nrf51_rng: Don't use BIT_MASK() when we mean BIT() Date: Mon, 18 Nov 2024 13:46:29 +0100 Message-ID: <20241118124643.6958-3-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934034491116600 From: Peter Maydell The BIT_MASK() macro from bitops.h provides the mask of a bit within a particular word of a multi-word bit array; it is intended to be used with its counterpart BIT_WORD() that gives the index of the word in the array. In nrf51_rng we are using it for cases where we have a bit number that we know is the index of a bit within a single word (in fact, it happens that all the bit numbers we pass to it are zero). This happens to give the right answer, but the macro that actually does the job we want here is BIT(). Use BIT() instead of BIT_MASK(). Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241108135644.4007151-1-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/misc/nrf51_rng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/misc/nrf51_rng.c b/hw/misc/nrf51_rng.c index bf1eb0cf4a..2d67f3f766 100644 --- a/hw/misc/nrf51_rng.c +++ b/hw/misc/nrf51_rng.c @@ -107,25 +107,25 @@ static void rng_write(void *opaque, hwaddr offset, break; case NRF51_RNG_REG_SHORTS: s->shortcut_stop_on_valrdy =3D - (value & BIT_MASK(NRF51_RNG_REG_SHORTS_VALRDY_STOP)) ? 1 := 0; + (value & BIT(NRF51_RNG_REG_SHORTS_VALRDY_STOP)) ? 1 : 0; break; case NRF51_RNG_REG_INTEN: s->interrupt_enabled =3D - (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) ? 1 : 0; + (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) ? 1 : 0; break; case NRF51_RNG_REG_INTENSET: - if (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) { + if (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) { s->interrupt_enabled =3D 1; } break; case NRF51_RNG_REG_INTENCLR: - if (value & BIT_MASK(NRF51_RNG_REG_INTEN_VALRDY)) { + if (value & BIT(NRF51_RNG_REG_INTEN_VALRDY)) { s->interrupt_enabled =3D 0; } break; case NRF51_RNG_REG_CONFIG: s->filter_enabled =3D - (value & BIT_MASK(NRF51_RNG_REG_CONFIG_DECEN)) ? 1 := 0; + (value & BIT(NRF51_RNG_REG_CONFIG_DECEN)) ? 1 : 0; break; =20 default: --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934041; cv=none; d=zohomail.com; s=zohoarc; b=CUmNdKdsNqLXQUKrTBN0aRXDNOGmO59IhyGBPuw9lnGwS1QAerCySn7qKnbtnljEhy0ts1fX+QIE/yD7tujM1m//tEUgl+OxXtTYw2ENVMOTNui29u36gVH16y00qN+fkwHzkayV1s/3jYCvBy6XZ0Q2qnBaZAQ2zTgZJzAIAPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934041; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GKQcu6yyxgnJym09mQmqk/PdgN/HdWF9BDJSP2Hzwtk=; b=KivErW+B5Y1Cx3kU/VSpZ74gixq3L1j53nrlUpyFwzGMH+18a59ZzlgP8A+rSOv9QURvjDOfk4aPV93+5+ehXw0/VFP5sGpv+j4pzhExSnGTd+ApFzmV9YBpCqZJd22OenUq8ATre2dJ6K+bYDLJYYCPjYjvggkBrGeeVr3aAcQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934040909608.9538452159451; Mon, 18 Nov 2024 04:47:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD19o-0002yz-66; Mon, 18 Nov 2024 07:47:08 -0500 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 1tD19m-0002yd-JR for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:06 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19k-0005Ns-Ql for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:06 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3822b77da55so1514713f8f.1 for ; Mon, 18 Nov 2024 04:47:04 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821ae161d8sm12987275f8f.78.2024.11.18.04.47.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934023; x=1732538823; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GKQcu6yyxgnJym09mQmqk/PdgN/HdWF9BDJSP2Hzwtk=; b=BFdlMj8dE1vOYtRZRJP6ljP1/sztQMndGcBWIscTpwK4wwc4aQnvFRMax0FVF39p1i 05slaTO78xIz/zuhiMNGdqzTAFJxvTNekxXGOQUV2LTatkF0cALPC+vwQyHEybx1ox/Y MgHMVWZPOXEq273C7WPoKTSTUcJaHnO841FQLVIFCZ2BQFExCO5UZoo1m9d6pu3Ref2o ELr9X75TxJfw3jlvhuZKpyy0FUY00aEqKWhQ1cAsyB7ZJTNrQ9qpYgJ4j93RZMgavQ9Z OB9MFoEOWpGoiJpe/vqpaBkEhXreZSjmHDQlYlnSEti8IOE6bvLicwGeZpaC9GpKXvuQ tyfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934023; x=1732538823; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GKQcu6yyxgnJym09mQmqk/PdgN/HdWF9BDJSP2Hzwtk=; b=Q9ttgvL4HVIO4iuIf9N8Oo8LpoOm9x2+Cxj5WB6ebvVMdbnml9zEwpHD5+S+GXXQp7 G2wZRsL4nfG5uwwqfjkVqAkSLar33NZ+HXrEIR0wGtgThWmx8EcnykeT59hGDHnF9byT Qh09hMmUNJp5dw6ACMDT77zOdLcIsozssRu/WcsMO/zGUph6un656ehRzreyTH1/pUhB p/GDJ1E7zLRWoNi363bschaFuiYHGYvjjxAokZZEdi9VRVYncPFy3save9wGphMddxrg vRbu1ItWbjZomMYv9+ZEQjDAXP9wsa8Z+KjTTHhT7iwr0SbgVQ496jw7O/5fHbdfQp2Q zhVg== X-Gm-Message-State: AOJu0YwYFJcSbjKzVDzir+pvHJcN4o7xJ6/Ky/FnXXkUmpIDCnw6nOaq 8pyCplz50LBTOO72yLzMU4r14c3SKWaomnGMheWhW3MAW1+9D6RaDllI1XYnAyTXQoHizDXOVKN O X-Google-Smtp-Source: AGHT+IFU0k7Q+poTGX59Kj+jvpvaoDOfPIajK7qRMQXzDXvE3SrvOgZWOeQRt7wM28JJRawOmw6+Aw== X-Received: by 2002:a5d:5889:0:b0:367:8e57:8 with SMTP id ffacd0b85a97d-38214064639mr15163179f8f.19.1731934022793; Mon, 18 Nov 2024 04:47:02 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Sergio Lopez , "Michael S . Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 03/15] hw/i386/elfboot: allocate "header" in heap Date: Mon, 18 Nov 2024 13:46:30 +0100 Message-ID: <20241118124643.6958-4-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934042430116600 From: Sergio Lopez In x86_load_linux(), we were using a stack-allocated array as data for fw_cfg_add_bytes(). Since the latter just takes a reference to the pointer instead of copying the data, it can happen that the contents have been overridden by the time the guest attempts to access them. Instead of using the stack-allocated array, allocate some memory from the heap, copy the contents of the array, and use it for fw_cfg. Signed-off-by: Sergio Lopez Reviewed-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241109053748.13183-1-slp@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/x86-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index bc360a9ea4..dc031af662 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -697,9 +697,11 @@ void x86_load_linux(X86MachineState *x86ms, strlen(kernel_cmdline) + 1); fw_cfg_add_string(fw_cfg, FW_CFG_CMDLINE_DATA, kernel_cmdline); =20 + setup =3D g_memdup2(header, sizeof(header)); + fw_cfg_add_i32(fw_cfg, FW_CFG_SETUP_SIZE, sizeof(header)); fw_cfg_add_bytes(fw_cfg, FW_CFG_SETUP_DATA, - header, sizeof(header)); + setup, sizeof(header)); =20 /* load initrd */ if (initrd_filename) { --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934095; cv=none; d=zohomail.com; s=zohoarc; b=R/N0mTcxIaHFFZhokJH7Td9mRe0Tnid+PhNkTwN8r++sDppAR7sTCc6JcvhoOVoEyJaGeLPwK+8htT72aRa0sqIAosHvX7SCXVInj0sCCCqLWPTx1FTJYGZs78tm6qQXHASramqaF/4XmmQpxgAj1VbiqaiFXABemly9w+iu7Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934095; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x/HCHXMnEBiDeYb/y8ziPz9hA5jzwBngAlzN9BmJ4hI=; b=il/L5jwANfbyZ5Qcn77ud+JMrm0aX/FvlnUrmhA1S2tn6+SYUtr5w9mZ8UsqgTD1dBd9XUucFpDbmnRDjYrXgVFuHOJ8uavChgWYv/sclVep2bG8/051q0lbAlSoiVFrIYWfgH7jpf8+C+mXTDQfNlPbvJUoO2hSpZ91V99YThs= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934095963945.8713454008343; Mon, 18 Nov 2024 04:48:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD19u-00032R-8T; Mon, 18 Nov 2024 07:47:14 -0500 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 1tD19s-0002zI-4k for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:12 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19q-0005ON-64 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:11 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43161e7bb25so34169055e9.2 for ; Mon, 18 Nov 2024 04:47:09 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3821adbe7dfsm12533069f8f.56.2024.11.18.04.47.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934028; x=1732538828; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x/HCHXMnEBiDeYb/y8ziPz9hA5jzwBngAlzN9BmJ4hI=; b=YDp9DHPQjmtN/ZX9YNAZFkirT5453yo880ERxT3jBZnrWYxSD9QbfP2LbPT7+tIHS+ gCIUIWjSGBkU7bYZsOPR09eqTWZdedk4qmC2HtH0raCt83jvTKlb3D/hLQIk7VxinOZl JMtipFN/Uz6dvWbSqqMxj5wWVoE0jlDModUJiVbitUllGxNuDcJX0aCIsZtED3ukVcdB mpyQtG/dAqI/6iKzxUB+eXEYlrmOFHFTwm0HOW93XiW2wZ6U8KMiXNx/A2HpRhFwCkPk Q0lQuBmI1rrcqIuADSjwyaj73gctt+sJvAEt4pNR3xGZ+pDcDWlKTzYHicxTzDqKr+UO OCdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934028; x=1732538828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x/HCHXMnEBiDeYb/y8ziPz9hA5jzwBngAlzN9BmJ4hI=; b=lnbl1t/vwb6FdB6NEad8eoPzwFuPMGZh1ElUhmxqaHY1xw4o1envdUf0+urOqHPqYN cJV05IuEiHVycXBeUqChKrCSr4yvlyPwKhUCP8lXpGET9Dkv9yRpPJ6fzmGQAn+K7obw gHgTuhGE8QYecUPuFARjQRgaBtW4MWDdS9Vug4l6b70GWRKVixj66WQARewd7eL3KYWn CqkhdtHEuHIy7RWnBtcBFnE/TbvayF69uLC2F4CZ4kOmh9RcqbpSYcVqOaQUrdaiU6sp Zqz6RgpXjCoczLMUH4nA/HptzDw3CPN5cnCrOUDstXB9GG34OxBOFWVA9uWxMeZPkZGe RPxg== X-Gm-Message-State: AOJu0Yz+AHiMMMmMCkQ6FKYF+Fl42eDAz3DS2oKs5en3v6SA4z0oCSVr DuDQgsLys7KoncAKBjjLRFyv7oTCbKf+gNmUj3rVBlZdRbEN9RpbSOjUt+BIRi/awadr8SyAJyA g X-Google-Smtp-Source: AGHT+IEw/yUPTzIK0SlphR6COFUgkFUAA41s2ghqCIsxKNjb3jNgCEcH3UlWoGfGolM1zSI1tlobjA== X-Received: by 2002:a05:600c:3b20:b0:431:5a93:4e3c with SMTP id 5b1f17b1804b1-432df74cdb3mr117437165e9.16.1731934028473; Mon, 18 Nov 2024 04:47:08 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dmitry Osipenko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 04/15] hw/display: factor out the scanout blob to fb conversion Date: Mon, 18 Nov 2024 13:46:31 +0100 Message-ID: <20241118124643.6958-5-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934096888116600 From: Alex Benn=C3=A9e There are two identical sequences of a code doing the same thing that raise warnings with Coverity. Before fixing those issues lets factor out the common code into a helper function we can share. Signed-off-by: Alex Benn=C3=A9e Cc: Dmitry Osipenko Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Message-ID: <20241111230040.68470-2-alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/virtio/virtio-gpu.h | 15 +++++++++ hw/display/virtio-gpu-virgl.c | 22 +------------ hw/display/virtio-gpu.c | 60 +++++++++++++++++++++------------- 3 files changed, 53 insertions(+), 44 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 553799b8cc..924eb8737e 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -333,6 +333,21 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g, struct virtio_gpu_scanout *s, uint32_t resource_id); =20 +/** + * virtio_gpu_scanout_blob_to_fb() - fill out fb based on scanout data + * fb: the frame-buffer descriptor to fill out + * ss: the scanout blob data + * blob_size: size of scanout blob data + * + * This will check we have enough space for the frame taking into + * account that stride for all but the last line. + * + * Returns true on success, otherwise logs guest error and returns false + */ +bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_set_scanout_blob *ss, + uint64_t blob_size); + /* virtio-gpu-udmabuf.c */ bool virtio_gpu_have_udmabuf(void); void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res); diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index eedae7357f..145a0b3879 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -805,7 +805,6 @@ static void virgl_cmd_set_scanout_blob(VirtIOGPU *g, struct virtio_gpu_framebuffer fb =3D { 0 }; struct virtio_gpu_virgl_resource *res; struct virtio_gpu_set_scanout_blob ss; - uint64_t fbend; =20 VIRTIO_GPU_FILL_CMD(ss); virtio_gpu_scanout_blob_bswap(&ss); @@ -852,26 +851,7 @@ static void virgl_cmd_set_scanout_blob(VirtIOGPU *g, return; } =20 - fb.format =3D virtio_gpu_get_pixman_format(ss.format); - if (!fb.format) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: pixel format not supported %d\= n", - __func__, ss.format); - cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; - } - - fb.bytes_pp =3D DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8); - fb.width =3D ss.width; - fb.height =3D ss.height; - fb.stride =3D ss.strides[0]; - fb.offset =3D ss.offsets[0] + ss.r.x * fb.bytes_pp + ss.r.y * fb.strid= e; - - fbend =3D fb.offset; - fbend +=3D fb.stride * (ss.r.height - 1); - fbend +=3D fb.bytes_pp * ss.r.width; - if (fbend > res->base.blob_size) { - qemu_log_mask(LOG_GUEST_ERROR, "%s: fb end out of range\n", - __func__); + if (!virtio_gpu_scanout_blob_to_fb(&fb, &ss, res->base.blob_size)) { cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index c0570ef856..e7ca8fd1cf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -721,13 +721,48 @@ static void virtio_gpu_set_scanout(VirtIOGPU *g, &fb, res, &ss.r, &cmd->error); } =20 +bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_set_scanout_blob *ss, + uint64_t blob_size) +{ + uint64_t fbend; + + fb->format =3D virtio_gpu_get_pixman_format(ss->format); + if (!fb->format) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: host couldn't handle guest format %d\n", + __func__, ss->format); + return false; + } + + fb->bytes_pp =3D DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb->format), 8); + fb->width =3D ss->width; + fb->height =3D ss->height; + fb->stride =3D ss->strides[0]; + fb->offset =3D ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb-= >stride; + + fbend =3D fb->offset; + fbend +=3D fb->stride * (ss->r.height - 1); + fbend +=3D fb->bytes_pp * ss->r.width; + + if (fbend > blob_size) { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: fb end out of range\n", + __func__); + return false; + } + + return true; +} + + + static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cm= d) { struct virtio_gpu_simple_resource *res; struct virtio_gpu_framebuffer fb =3D { 0 }; struct virtio_gpu_set_scanout_blob ss; - uint64_t fbend; =20 VIRTIO_GPU_FILL_CMD(ss); virtio_gpu_scanout_blob_bswap(&ss); @@ -753,28 +788,7 @@ static void virtio_gpu_set_scanout_blob(VirtIOGPU *g, return; } =20 - fb.format =3D virtio_gpu_get_pixman_format(ss.format); - if (!fb.format) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: host couldn't handle guest format %d\n", - __func__, ss.format); - cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; - return; - } - - fb.bytes_pp =3D DIV_ROUND_UP(PIXMAN_FORMAT_BPP(fb.format), 8); - fb.width =3D ss.width; - fb.height =3D ss.height; - fb.stride =3D ss.strides[0]; - fb.offset =3D ss.offsets[0] + ss.r.x * fb.bytes_pp + ss.r.y * fb.strid= e; - - fbend =3D fb.offset; - fbend +=3D fb.stride * (ss.r.height - 1); - fbend +=3D fb.bytes_pp * ss.r.width; - if (fbend > res->blob_size) { - qemu_log_mask(LOG_GUEST_ERROR, - "%s: fb end out of range\n", - __func__); + if (!virtio_gpu_scanout_blob_to_fb(&fb, &ss, res->blob_size)) { cmd->error =3D VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER; return; } --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934133; cv=none; d=zohomail.com; s=zohoarc; b=gFBDe5qprVjGYrdr0AcuYWpatYB/JC1LU6TWDwdPV7/EOebC9SY132flskQ4/xOGA7V4jc/CmDGYpwqYGMPKfEpcUD32uOdsa+1zgPfBL/jRUlruVuiimXf6qQ4A3x2zAqY1Dkl8ifN8D3iZumwP12NOKqQ5Nu2TqlanrSNxacg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934133; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ub7X6sJHrjB0SzaYTR/xmHntoa5aUSaWnEy/yeF5Dbw=; b=bIjWAALrYPat8c1R7U+3JHXO7tTUKVV651c+wiwKf9jVed8Vx1noioyxzLcXoqbWsI7Xf/BJWrSgeUzdoEd7ikfYk4hPZDK5VANMIn02zxoaSFoBYKVM3jUFtUQGOUfR069PgxPPrragTLlukIAR6lA8wNb7Csr1K+I81qUhB+8= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934133324770.2054350992798; Mon, 18 Nov 2024 04:48:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1A0-00037i-24; Mon, 18 Nov 2024 07:47:20 -0500 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 1tD19x-00036l-Mg for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:17 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD19w-0005Oi-3c for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:17 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3823cf963f1so992643f8f.1 for ; Mon, 18 Nov 2024 04:47:15 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38244355924sm4098904f8f.46.2024.11.18.04.47.12 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934034; x=1732538834; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ub7X6sJHrjB0SzaYTR/xmHntoa5aUSaWnEy/yeF5Dbw=; b=qH3ksDh8AOeUFeTRRfg6RyCDwV92sxwPTl5zouS+2a8tGfTq94nVl2O064Dky83hCH HJNyf3LrghGxhO8jRU+MhNLtrWFN2swPYCxrU6TWUrRxVGy9TrivOIvwcVWDr0jVONYq bT5abUKR8M5TfAdLFa9WMmsieCYPS85QhYgJjdLvQA3jh8cVDlriRm8SPYlREx1lepO2 IFRb79IA4HR0Rww7Ah70BYWWbQ3u+hMHyfHla9ju3eyfzh/qQIT8nM/QTSrJqdr8z8eo +StbxY1awK9GJZrq2YarU1wAhYE9aHp+4HoDbX3XXhqhwlv5hUSjn1Ab190TkUkgY413 ODdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934034; x=1732538834; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ub7X6sJHrjB0SzaYTR/xmHntoa5aUSaWnEy/yeF5Dbw=; b=OY0CxyvM6Z/mSHZhGkDd5fiq0kptX6j9FPKXgjzOeoHPU1GfU8+DzmfjN8BxKBwzbD liu9Et/Akcq9fsyTytGjdBWNXcd5PcgkYjky1OQ18f50PIdcj1/cAg5A/6B4oVl9Nm9p ogMhngqlJBwGJezKI2Fm2W3/3JcqOQc1G1bJZ+i0nBF69zA6xKZKbZVToBACiYab+ytt TsDUM5oSmX0YV/L3baEq7M6ELcVFYmvIwfDEI1LUWEc1pTQcSUZC0uA0jdNbnIMnI/Ha 08EG7oTr62jOVpAb8tK6Nc/2AthK3CGz+Nllfos1vNjY2AQSLMQRvwJzvUcMqm1Zoy9l Ks0A== X-Gm-Message-State: AOJu0Yx7nOTPy147JhIEmkPr5RbQ0Mf4z9F3++HUchf3m/6L7oC3SXD9 tWB+3D31fZxc4CKgx9RwTo+PKwUgFNjAkdBMdxnaFB0nRCnFiJ27Lz+mSnRYeiR2w20Amw+2XQY d X-Google-Smtp-Source: AGHT+IEZUGNePzS+TPyOvqiyJ5vGiJdhhtigcxedUAhIjNsLqs02G43atR8nzMgcPOKKnOkPt1/NZw== X-Received: by 2002:a5d:5c0e:0:b0:382:4a4e:25bb with SMTP id ffacd0b85a97d-3824a4e2883mr1474474f8f.46.1731934034135; Mon, 18 Nov 2024 04:47:14 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Dmitry Osipenko , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/15] hw/display: check frame buffer can hold blob Date: Mon, 18 Nov 2024 13:46:32 +0100 Message-ID: <20241118124643.6958-6-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934134712116600 From: Alex Benn=C3=A9e Coverity reports (CID 1564769, 1564770) that we potentially overflow by doing some 32x32 multiplies for something that ends up in a 64 bit value. Fix this by first using stride for all lines and casting input to uint64_t to ensure a 64 bit multiply is used. Signed-off-by: Alex Benn=C3=A9e Cc: Dmitry Osipenko Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko Message-ID: <20241111230040.68470-3-alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/virtio/virtio-gpu.h | 2 +- hw/display/virtio-gpu.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 924eb8737e..8c977beebd 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -340,7 +340,7 @@ void virtio_gpu_update_cursor_data(VirtIOGPU *g, * blob_size: size of scanout blob data * * This will check we have enough space for the frame taking into - * account that stride for all but the last line. + * account that stride. * * Returns true on success, otherwise logs guest error and returns false */ diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e7ca8fd1cf..7d22d03bbf 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -742,8 +742,7 @@ bool virtio_gpu_scanout_blob_to_fb(struct virtio_gpu_fr= amebuffer *fb, fb->offset =3D ss->offsets[0] + ss->r.x * fb->bytes_pp + ss->r.y * fb-= >stride; =20 fbend =3D fb->offset; - fbend +=3D fb->stride * (ss->r.height - 1); - fbend +=3D fb->bytes_pp * ss->r.width; + fbend +=3D (uint64_t) fb->stride * ss->r.height; =20 if (fbend > blob_size) { qemu_log_mask(LOG_GUEST_ERROR, --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934104; cv=none; d=zohomail.com; s=zohoarc; b=CdqNqt6Fboo/DJLwGeezS7r8GngNwlDC+gD4IUBeV5D9UNKvE06/+kFtJxKxrLyHIvGwpMuJD6hjbqwGr00+P20gBcefsTBOtvkYhWwt+OfZMeR/S8cZEPYdOPRBh2qmAb03bktHTDz0OGHsCD+77ugeQEjQ2r1Ih1NEwSQ+OtE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934104; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=57xyOJgb7MrtuQp8S+1k7r8lU95GPrcuInZY97Vgr3w=; b=infy/5syg2ozFEJxa1TIke2NYIRLwktkNjQvZg+ZObcLoXpjL7wcqb9iFqCPYFu0sAvScNjuqxUAxpHl9HOkzal3L3wfqwnPzkGUxwIYbTuHGSPLzLcGQQLsXSw4yvrR5QaW8IWrFsS4L8fFpajFV04bD9IljUg+NONpD0bdvb8= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934104149706.2796139959092; Mon, 18 Nov 2024 04:48:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1A7-0003JX-K5; Mon, 18 Nov 2024 07:47:28 -0500 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 1tD1A3-0003CF-1X for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:23 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1A1-0005P0-Jn for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:22 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-382423f4082so929280f8f.3 for ; Mon, 18 Nov 2024 04:47:21 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3822e65cbdasm9119775f8f.7.2024.11.18.04.47.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934040; x=1732538840; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=57xyOJgb7MrtuQp8S+1k7r8lU95GPrcuInZY97Vgr3w=; b=puz44dusnzUY4XWwEPc+Kz9e9ANwZ96rSmdjDJn5pSjG+JGPgscD7ICkeSGALgrlaK H7Ydl/0M+QgUJTDXK/QplIbJ+pwC6TROJk5z6QBphJSlJbBTpVuwNzJSb2ZA6oB4LeCB Z55xk6AHnAtFZyMbXywH+nBq9CEVfAc3jNMbWKPh2naUKWwH8Ids11IyXtLuz4SiiEsj p5qtb2cTeUGXkM5zxXmlcRcPlRPyTJEbnNxHL2sIWY/xph8fTZeyEuWYyQWMCll4kJOp XCSeM3Bn5qdfte6na/XwqTJH+uQj+Yu6FTL88kN32/Ndn9+N5FgtEDXN23pgnaNymLcd t5og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934040; x=1732538840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=57xyOJgb7MrtuQp8S+1k7r8lU95GPrcuInZY97Vgr3w=; b=rtz2wzAcWdBSyoiPYMv8o3UJCej27l8Po+V8xZ84Bab30QGV9KhrErkun16HuVxudI ZZyGoE1Brd8TR7wChXOFKG9TW6gxoHfNPucwPGv93z4V1qE2HhiyyoehphxmXygXq9LC 6Yx7LpfrBvxEhr8qCHIxS6o5c2SlwvbyHsDKuPAdrUx6yp6Hq+cLKd8AJWPNKs8klwbS v9zb6Lb2t5Q1blcMmKB665UMgb7yD+VDspRq4XBk1kJUiNiNKYSUoj3xrUO6dI4HlYtk HiN4Zh/yM5b14TVbj4C0bYiAeaJWiplemQpai4zOsRiWIcNy7ZWMbRJ4b76+c58g53uG 23yA== X-Gm-Message-State: AOJu0Yz0aXIncL33aLAH1kbYFiOFdp/oYuULiJNLbA6Rr50Z1ZLqLUsm ONmICPtCL+Fy7bo5ycMn0E/ouxc8gtHvg/ZMTMb6F3bDRATMIyzRsg3w/csRi8Rh0VpnRDxHjAN V X-Google-Smtp-Source: AGHT+IF3DUWa/uhuUCxyLTGnGr3Zxfm5V3YNEHF1T9vlk1op3xVZ5SkkFXBwGVmUowjQNReEJCXDzA== X-Received: by 2002:a5d:47ab:0:b0:382:3789:191c with SMTP id ffacd0b85a97d-38237891a14mr6122659f8f.7.1731934039822; Mon, 18 Nov 2024 04:47:19 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Zhang Chen , Li Zhijian , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 06/15] MAINTAINERS: Update my email address for COLO Date: Mon, 18 Nov 2024 13:46:33 +0100 Message-ID: <20241118124643.6958-7-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934104582116600 From: Zhang Chen Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian Message-ID: <20241112084038.6352-1-chen.zhang@intel.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 095420f8b0..3f10529d9c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3559,7 +3559,7 @@ F: include/migration/failover.h F: docs/COLO-FT.txt =20 COLO Proxy -M: Zhang Chen +M: Zhang Chen M: Li Zhijian S: Supported F: docs/colo-proxy.txt --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934214; cv=none; d=zohomail.com; s=zohoarc; b=coPUovQ826DP6g+OHGw/p+GRnjLEqkyiLm2EoRysQjA1caRw5EfL7T1jHaq9jHnFGLnXPfjtDVPjHX+IybrLNSN57DCgR5J9+Fus7KPlY0MxPEQQQ5snNRs8tWSsa1tl7bO4Q86rfugQihPu4ZO0FBJWijEaAilTNVvGUL1bvm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934214; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/ttdwyIWnlE0XcHxa21WmzaMS4O1MZxffEe5jLcx9RE=; b=noonbicgqG+hTyt/qO6GUGC7gAX7xKnsVywANVk1GP+2OX/TuxTw1v3Cn7pfbRzhFUqt+cTiGq8FohzwjbCegqsNfV2YWJiSmDGTFwo0Kn3A0kITTNHRjjSXkPGIwGVK9QBCzDnzoXEcGKpM+UU2xK69NW9z4p8vxsVAqG8YOk4= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934214483296.1812026828786; Mon, 18 Nov 2024 04:50:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1AA-0003Pw-O3; Mon, 18 Nov 2024 07:47:30 -0500 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 1tD1A9-0003Mt-EV for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:29 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1A7-0005PW-VK for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:29 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4314c4cb752so26875775e9.2 for ; Mon, 18 Nov 2024 04:47:26 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab78783sm154194365e9.12.2024.11.18.04.47.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934045; x=1732538845; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/ttdwyIWnlE0XcHxa21WmzaMS4O1MZxffEe5jLcx9RE=; b=XIOrZcikEyo//fXKLMdc/8TV6ZB289n+ijbbARZmvjBY8HLl9cWGgfqA8MqpUGge+d 3E7Dnx44UIEtcYgKLLjDf5LkVq+mcfM/0hrJ6jMjZwD1womkQcTvYi9zCz3/X24ldNE6 W5mrMgMA+G2TRJpw9zX2pu5JGnZS4vBMXg6zgwulRSHQO6dec2PJPGd8kAJnHH/ygtT/ VG1bUgbfQk6f/J/CGYBCPdapHGbNr6W3dCF4/t5Oy2LHrHDZD/qhaLZMnW/czhi4uOOn YdsQO6wWCdQSrbvRUf1hOznBSVpTPviLL5SP4/BIYxEdlyEDUbQpGeFcV8IMtJQ3mG3g n6zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934045; x=1732538845; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/ttdwyIWnlE0XcHxa21WmzaMS4O1MZxffEe5jLcx9RE=; b=gXf15XR05s6fXwYmJr+d0m9URI93OIL8tPUz5jxWGU5Kv+ItdzqLujkF8ZztNMs99R LES5KL53WCfF40NLjoA1CrUZX6Zu5Hytp5waggdl1DwlH8kK7Ga38V6E7MJLM6ILx/G7 GoUER7IbYJ5ye4fCAW5pKBA3CZrhmCF2sPGCEJF3L3mVigxuw3QAOUEyduQatBmiRlb8 6diMy7cAmSAx765y04h9ox3b1KYAScmWQlUibpgNjThN5+wnuPV3MIWWTsQnLhDBhTw3 Y+e5p/Isdb4JfydyxA27Xv+L+LW909S5LZepss+uN1UZD3P2mGVAS8+vF53bifDCokJS noxA== X-Gm-Message-State: AOJu0Yz8BkFLBUgJiG3d+TELKOKjJ1sPP/dLBn/9IVX+osBGTR8Znqsn mMtcLYDW54qzE9bqSKBlJL5KsbrQaq26pu/Nv2V4n8tNh9v3OnK3K1yOShU3RItuJDp0btwIuU0 n X-Google-Smtp-Source: AGHT+IFhVzV7qI53Z++fgv2tXiSftzwzfLkHf8Iy3AmOVyNgXGf5NzN9vnaU5OeQMCi1RODmFKSX+g== X-Received: by 2002:a05:600c:1908:b0:431:52da:9d67 with SMTP id 5b1f17b1804b1-432df7178f9mr114301385e9.3.1731934045442; Mon, 18 Nov 2024 04:47:25 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Guenter Roeck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 07/15] usb-hub: Fix handling port power control messages Date: Mon, 18 Nov 2024 13:46:34 +0100 Message-ID: <20241118124643.6958-8-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934215345116600 From: Guenter Roeck The ClearPortFeature control message fails for PORT_POWER because there is no break; at the end of the case statement, causing it to fall through to the failure handler. Add the missing break; to solve the problem. Fixes: 1cc403eb21 ("usb-hub: emulate per port power switching") Signed-off-by: Guenter Roeck Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241112170152.217664-11-linux@roeck-us.net> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/usb/dev-hub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index 06e9537d03..2c3640c705 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -479,6 +479,7 @@ static void usb_hub_handle_control(USBDevice *dev, USBP= acket *p, usb_hub_port_clear(port, PORT_STAT_SUSPEND); port->wPortChange =3D 0; } + break; default: goto fail; } --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934132; cv=none; d=zohomail.com; s=zohoarc; b=HKrRs79iqr9096d5y7ZdBxf2R53w2TPxqWHAYUKU3dBE0l+pGgEe785idPNr273LmAFPnaU5sVnnRXm0l4tZlQWqJx/Eo0JrSIpLxnD8NueO/JAUVW2rh+X1ZYssFqQH/rQuy/uchubW9Yoib6YkfoIosT/ooo3AT/zWKIoQc/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934132; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2gvzG87mZ1DQ2Kjs6nzKGtjxs99fZsVPRk+MyRMt3sI=; b=YNFeJKmUHKo4ybNmk327nM0CIrdkKXdn3cSJo6LKyYTtLZGjFUJOAovzUtOIExU+5meYC5UFa1vnwmJCETV3pe9j4Vb/l12YCXtSvPWpwVojSivsfScupqmu1CVPHayVFMM6wWZzeyueReOkU2oYfL3Ekg5vq32xba3MZmBQaLo= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934132888838.0196142814304; Mon, 18 Nov 2024 04:48:52 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1AG-0003UJ-Ib; Mon, 18 Nov 2024 07:47:36 -0500 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 1tD1AE-0003Si-Sj for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:34 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AC-0005Pw-VF for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:34 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4315baa51d8so27000355e9.0 for ; Mon, 18 Nov 2024 04:47:32 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da244cb6sm161586485e9.0.2024.11.18.04.47.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934051; x=1732538851; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2gvzG87mZ1DQ2Kjs6nzKGtjxs99fZsVPRk+MyRMt3sI=; b=uYEBMIHEMQEEIdZ5D3rDFeJWfwsbprukgS6QlltSEYXJgdBIpESIQ4a8PD7HiTNJHE CDlBLEboT2jrbBrPHz0kiJK5UdKIbZXKqAaln35j7jbEuEcpAEP0ofgpWcUAa47pNrpU d0ZYP0ZUQNxhWw8OvlT3iEIpGpvwjL2eN7QX/oU8JzdiG+mIqnvGxTVBpEPyA57d6TkE 8NZmJWpylfUIRcyYeBzNe93eUmPuYs++uIylCMHykMYBaAqhfPpSYgrfVguwRUzIRcnH 8QC+ZyhAT31WO1cIrQNAsODEMjDDLtP2HhHsj1fsbsQs0caJSyY9HzMoJ8u4Ifua+Af7 rODg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934051; x=1732538851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2gvzG87mZ1DQ2Kjs6nzKGtjxs99fZsVPRk+MyRMt3sI=; b=wdLJT4PKevbFq2fRniej1YjTSiNP07WghEOXyySF+Es35aQft6iUToH9xTvYivJTf1 uRjGo2kNOgGwGK6+guTs374y6gbVOtvHrzsJP10Bf7Xl/4YTu4Uo+aeSTS1sAWV540pU YsVFvmY7ArNrhxlSR8tD4AX+4DrS7JAQNXabeLTutz7C0Jsyvhir++8GsMcAYuxX01T/ WrjIiUpcgBy6oV7HSswaHojcIuF1XfkLGxFkW/njv/TNF8p5s61+6g7F7xv33IFDe8eG WDRT++OuoDzcxFkbQzccpv3SqqgIzulhE3VlVS57PxxQSdpwTQKvlMRzFMkjhumJKsj7 Dnzg== X-Gm-Message-State: AOJu0Yx7a5YsaJEhtEmalwzbRYeGaKUX3wQSiDqWUmXXDVce0vFopoIL khJBJZyQd2kKxIMkDry/AvXvZ+FVBV/ognvXTl0yHcpuWd6Hqn3lqtQeqBm9WpP0Sy85ehxNyQ0 0 X-Google-Smtp-Source: AGHT+IHnBk5jlKkZZA6gUPUoeIe8kEIw1QAz4R0/iOc0cus7Roe+z/LDvWCVBdqEqtZa7LzESyrZCg== X-Received: by 2002:a05:600c:3ba7:b0:42c:b52b:4335 with SMTP id 5b1f17b1804b1-432df725265mr118347755e9.10.1731934051088; Mon, 18 Nov 2024 04:47:31 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Fabiano Rosas , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 08/15] tests/qtest/migration: Fix indentations Date: Mon, 18 Nov 2024 13:46:35 +0100 Message-ID: <20241118124643.6958-9-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934134833116600 From: Fabiano Rosas Select all the code and hit tab. I'll be moving functions around quite a lot in the next patches, so make sure all indentation is correct now. Add parentheses around some expressions to preserve readability. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Fabiano Rosas Message-ID: <20241113194630.3385-2-farosas@suse.de> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/migration-helpers.c | 4 +-- tests/qtest/migration-test.c | 59 ++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index 0025933883..3f8ba7fa8e 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -140,8 +140,8 @@ static void migrate_set_ports(QTestState *to, QList *ch= annel_list) if (qdict_haskey(addrdict, "port") && qdict_haskey(addr, "port") && (strcmp(qdict_get_str(addrdict, "port"), "0") =3D=3D 0)) { - addr_port =3D qdict_get_str(addr, "port"); - qdict_put_str(addrdict, "port", addr_port); + addr_port =3D qdict_get_str(addr, "port"); + qdict_put_str(addrdict, "port", addr_port); } } =20 diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e6a2803e71..74d3000198 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -113,8 +113,8 @@ static bool ufd_version_check(void) } uffd_feature_thread_id =3D api_struct.features & UFFD_FEATURE_THREAD_I= D; =20 - ioctl_mask =3D 1ULL << _UFFDIO_REGISTER | - 1ULL << _UFFDIO_UNREGISTER; + ioctl_mask =3D (1ULL << _UFFDIO_REGISTER | + 1ULL << _UFFDIO_UNREGISTER); if ((api_struct.ioctls & ioctl_mask) !=3D ioctl_mask) { g_test_message("Skipping test: Missing userfault feature"); return false; @@ -423,7 +423,7 @@ static void migrate_set_parameter_str(QTestState *who, = const char *parameter, } =20 static long long migrate_get_parameter_bool(QTestState *who, - const char *parameter) + const char *parameter) { QDict *rsp; int result; @@ -436,7 +436,7 @@ static long long migrate_get_parameter_bool(QTestState = *who, } =20 static void migrate_check_parameter_bool(QTestState *who, const char *para= meter, - int value) + int value) { int result; =20 @@ -445,7 +445,7 @@ static void migrate_check_parameter_bool(QTestState *wh= o, const char *parameter, } =20 static void migrate_set_parameter_bool(QTestState *who, const char *parame= ter, - int value) + int value) { qtest_qmp_assert_success(who, "{ 'execute': 'migrate-set-parameters'," @@ -1384,8 +1384,10 @@ static void test_postcopy_preempt_tls_psk(void) static void wait_for_postcopy_status(QTestState *one, const char *status) { wait_for_migration_status(one, status, - (const char * []) { "failed", "active", - "completed", NULL }); + (const char * []) { + "failed", "active", + "completed", NULL + }); } =20 static void postcopy_recover_fail(QTestState *from, QTestState *to, @@ -2575,15 +2577,17 @@ static void test_migrate_fd_finish_hook(QTestState = *from, /* Test closing fds */ /* We assume, that QEMU removes named fd from its list, * so this should fail */ - rsp =3D qtest_qmp(from, "{ 'execute': 'closefd'," - " 'arguments': { 'fdname': 'fd-mig' }}"); + rsp =3D qtest_qmp(from, + "{ 'execute': 'closefd'," + " 'arguments': { 'fdname': 'fd-mig' }}"); g_assert_true(qdict_haskey(rsp, "error")); error_desc =3D qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); g_assert_cmpstr(error_desc, =3D=3D, "File descriptor named 'fd-mig' no= t found"); qobject_unref(rsp); =20 - rsp =3D qtest_qmp(to, "{ 'execute': 'closefd'," - " 'arguments': { 'fdname': 'fd-mig' }}"); + rsp =3D qtest_qmp(to, + "{ 'execute': 'closefd'," + " 'arguments': { 'fdname': 'fd-mig' }}"); g_assert_true(qdict_haskey(rsp, "error")); error_desc =3D qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); g_assert_cmpstr(error_desc, =3D=3D, "File descriptor named 'fd-mig' no= t found"); @@ -2741,11 +2745,11 @@ static void test_validate_uri_channels_both_set(voi= d) }, .listen_uri =3D "defer", .connect_uri =3D "tcp:127.0.0.1:0", - .connect_channels =3D "[ { 'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ]", + .connect_channels =3D ("[ { ""'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]"), }; =20 do_test_validate_uri_channel(&args); @@ -2967,7 +2971,7 @@ test_migrate_precopy_tcp_multifd_qatzip_start(QTestSt= ate *from, #ifdef CONFIG_QPL static void * test_migrate_precopy_tcp_multifd_qpl_start(QTestState *from, - QTestState *to) + QTestState *to) { return test_migrate_precopy_tcp_multifd_start_common(from, to, "qpl"); } @@ -3032,11 +3036,11 @@ static void test_multifd_tcp_channels_none(void) .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_start, .live =3D true, - .connect_channels =3D "[ { 'channel-type': 'main'," - " 'addr': { 'transport': 'socket'," - " 'type': 'inet'," - " 'host': '127.0.0.1'," - " 'port': '0' } } ]", + .connect_channels =3D ("[ { 'channel-type': 'main'," + " 'addr': { 'transport': 'socket'," + " 'type': 'inet'," + " 'host': '127.0.0.1'," + " 'port': '0' } } ]"), }; test_precopy_common(&args); } @@ -3668,7 +3672,8 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full =3D 0; while (throttle_us_per_full =3D=3D 0) { throttle_us_per_full =3D - read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); + read_migrate_property_int(from, + "dirty-limit-throttle-time-per-round= "); usleep(100); g_assert_false(src_state.stop_seen); } @@ -3680,7 +3685,8 @@ static void test_migrate_dirty_limit(void) /* Check if dirty limit throttle switched off, set timeout 1ms */ do { throttle_us_per_full =3D - read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); + read_migrate_property_int(from, + "dirty-limit-throttle-time-per-round= "); usleep(100); g_assert_false(src_state.stop_seen); } while (throttle_us_per_full !=3D 0 && --max_try_count); @@ -3709,7 +3715,8 @@ static void test_migrate_dirty_limit(void) throttle_us_per_full =3D 0; while (throttle_us_per_full =3D=3D 0) { throttle_us_per_full =3D - read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); + read_migrate_property_int(from, + "dirty-limit-throttle-time-per-round= "); usleep(100); g_assert_false(src_state.stop_seen); } @@ -3989,7 +3996,7 @@ int main(int argc, char **argv) #endif #ifdef CONFIG_QATZIP migration_test_add("/migration/multifd/tcp/plain/qatzip", - test_multifd_tcp_qatzip); + test_multifd_tcp_qatzip); #endif #ifdef CONFIG_QPL migration_test_add("/migration/multifd/tcp/plain/qpl", --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934237; cv=none; d=zohomail.com; s=zohoarc; b=daBNu1/cEUB8jHD0sSFg5L0Kh9oNrp+7HtiGqFqcyxEoXeYIPs5zEXy2L/hNzpDeaPYA7pVJjQIGuanUoQH4PR9UJNTj41WUsOpwTLvwWUp56e7hYSjMAFbdsUH6jBUNpJQ+o1IBEBZwW/QAw/AeV25L21GW+MGlEhgMFPYCisw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934237; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4RMNsAKsb3Qz5FWv2s5/qn+pAlL7XprZnFyQSkFTZ2s=; b=Jhcrc7NoVYLBIV6hmL3DUNffEBCmnhgUE4wkhfOeCH1p7OP6HpuQDrQxs76o9VJRt1+663j8HaRXQ+F4neW2RIJeFga5PG8bFMzkZ4P8sg8b7/ehf/xr7aV+Y0AvrVOx2TRJ/1gbm5i2JPHISn8KdDH2LF8ISHee9GUeJF7BgzQ= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934237692377.90452932450785; Mon, 18 Nov 2024 04:50:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1AM-0003vN-PI; Mon, 18 Nov 2024 07:47:42 -0500 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 1tD1AL-0003pN-Cc for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:41 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AJ-0005QQ-2R for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:40 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43158625112so17935415e9.3 for ; Mon, 18 Nov 2024 04:47:38 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da28b698sm157531375e9.27.2024.11.18.04.47.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934057; x=1732538857; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4RMNsAKsb3Qz5FWv2s5/qn+pAlL7XprZnFyQSkFTZ2s=; b=q1bDQdYd1hFDMex44wN3IjKwShz0w+NbbHXstuu48clkx3A5r7FZBUL1Uudgo/WGoq ZTZKpFHiNHzLIAOfi3PyJ8Um5waflRvGNa0xK83qAfswL4YJTp57mOU2b10W3fIv7lMV YSVCGCrPyjxS9pL6EyTL+Aeua0PtctKlsii9sAJiSMQ0IAPYg7hExXxJRtUpGOeq+jJ8 YHI0ek6wOdrggeLI4KPc93KWALciKKoOguHBrmHWtA0CjC3pakMCEvzdkTCiIi8sMUZI aOzI4SZl0R1d8PubhpGl5WOHatJ5DHE3fD1inrXEWtHa9Ngu/Ot3vSj4hqz0PafQk9Q+ AvlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934057; x=1732538857; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4RMNsAKsb3Qz5FWv2s5/qn+pAlL7XprZnFyQSkFTZ2s=; b=TBC0YRIEa40KbTgQCyAo9BrxynraBodaj8DeoBl0zKcYLOEKIa3lhaQsE5BghK8TL9 1b3NUx3LjLOU7xoajNPj1bdh3rYZUTGJvPZ0SQpwsX7CH20ZNsyqN8XgLqNQoA3QZ0YR mcakYTqjI9gjWiO6+ugNfNaF40IGvq0QslkkD/CNJb6WXpkPireEy0/UW6TJLcGVRVMH 4+6Udgvku+zg/zov6PyCVDEr3uU+Hy0BUwDGxpsiv6x1COkzrpf+K8rx0+BAkfBxhcAa EJ/+fhXEYKye+Du4bu2vbosnnKowFiRJx0amOpnsoQ0b/O1UToImi0SZFEvUKbFV7ZUv xgoQ== X-Gm-Message-State: AOJu0YwSh+m7QwQFiGdaYdjI62TWIr8OtR4cpqjQtvLOHAFVkFnBvGWc DxsAADWH2HDAT4bwHXRBYxmijsAnGuU1BURpuXdqsWaLsFEHhlyGC+O/jKW+5NBiXSBFyldMt/o B X-Google-Smtp-Source: AGHT+IH0AQyZCKFFBKjD+MaHks98rxP+4fLTkqkhfvw2lFFAyZoT/5CiSZylIywQmXVG3klrX8FZMw== X-Received: by 2002:a05:600c:1c23:b0:430:5846:7582 with SMTP id 5b1f17b1804b1-432df72069amr96237215e9.7.1731934056920; Mon, 18 Nov 2024 04:47:36 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Jamin Lin , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 09/15] hw/sd/sdhci: Fix coding style Date: Mon, 18 Nov 2024 13:46:36 +0100 Message-ID: <20241118124643.6958-10-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934239316116600 From: Jamin Lin Fix coding style issues from checkpatch.pl Signed-off-by: Jamin Lin Reviewed-by: C=C3=A9dric Le Goater Message-ID: <20241114094839.4128404-2-jamin_lin@aspeedtech.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/sdhci.c | 64 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index dbe5c2340c..37875c02c3 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -233,7 +233,7 @@ static void sdhci_raise_insertion_irq(void *opaque) =20 if (s->norintsts & SDHC_NIS_REMOVE) { timer_mod(s->insert_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERT= ION_DELAY); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERTION_DEL= AY); } else { s->prnsts =3D 0x1ff0000; if (s->norintstsen & SDHC_NISEN_INSERT) { @@ -251,7 +251,7 @@ static void sdhci_set_inserted(DeviceState *dev, bool l= evel) if ((s->norintsts & SDHC_NIS_REMOVE) && level) { /* Give target some time to notice card ejection */ timer_mod(s->insert_timer, - qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERT= ION_DELAY); + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + SDHC_INSERTION_DEL= AY); } else { if (level) { s->prnsts =3D 0x1ff0000; @@ -289,9 +289,11 @@ static void sdhci_reset(SDHCIState *s) timer_del(s->insert_timer); timer_del(s->transfer_timer); =20 - /* Set all registers to 0. Capabilities/Version registers are not clea= red + /* + * Set all registers to 0. Capabilities/Version registers are not clea= red * and assumed to always preserve their value, given to them during - * initialization */ + * initialization + */ memset(&s->sdmasysad, 0, (uintptr_t)&s->capareg - (uintptr_t)&s->sdmas= ysad); =20 /* Reset other state based on current card insertion/readonly status */ @@ -305,7 +307,8 @@ static void sdhci_reset(SDHCIState *s) =20 static void sdhci_poweron_reset(DeviceState *dev) { - /* QOM (ie power-on) reset. This is identical to reset + /* + * QOM (ie power-on) reset. This is identical to reset * commanded via device register apart from handling of the * 'pending insert on powerup' quirk. */ @@ -445,8 +448,10 @@ static void sdhci_read_block_from_card(SDHCIState *s) s->prnsts &=3D ~SDHC_DAT_LINE_ACTIVE; } =20 - /* If stop at block gap request was set and it's not the last block of - * data - generate Block Event interrupt */ + /* + * If stop at block gap request was set and it's not the last block of + * data - generate Block Event interrupt + */ if (s->stopped_state =3D=3D sdhc_gap_read && (s->trnmod & SDHC_TRNS_MU= LTI) && s->blkcnt !=3D 1) { s->prnsts &=3D ~SDHC_DAT_LINE_ACTIVE; @@ -548,8 +553,10 @@ static void sdhci_write_block_to_card(SDHCIState *s) sdhci_update_irq(s); } =20 -/* Write @size bytes of @value data to host controller @s Buffer Data Port - * register */ +/* + * Write @size bytes of @value data to host controller @s Buffer Data Port + * register + */ static void sdhci_write_dataport(SDHCIState *s, uint32_t value, unsigned s= ize) { unsigned i; @@ -594,9 +601,11 @@ static void sdhci_sdma_transfer_multi_blocks(SDHCIStat= e *s) return; } =20 - /* XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account f= or + /* + * XXX: Some sd/mmc drivers (for example, u-boot-slp) do not account f= or * possible stop at page boundary if initial address is not page align= ed, - * allow them to work properly */ + * allow them to work properly + */ if ((s->sdmasysad % boundary_chk) =3D=3D 0) { page_aligned =3D true; } @@ -702,7 +711,8 @@ static void get_adma_description(SDHCIState *s, ADMADes= cr *dscr) dma_memory_read(s->dma_as, entry_addr, &adma2, sizeof(adma2), MEMTXATTRS_UNSPECIFIED); adma2 =3D le64_to_cpu(adma2); - /* The spec does not specify endianness of descriptor table. + /* + * The spec does not specify endianness of descriptor table. * We currently assume that it is LE. */ dscr->addr =3D (hwaddr)extract64(adma2, 32, 32) & ~0x3ull; @@ -977,8 +987,10 @@ static bool sdhci_can_issue_command(SDHCIState *s) return true; } =20 -/* The Buffer Data Port register must be accessed in sequential and - * continuous manner */ +/* + * The Buffer Data Port register must be accessed in sequential and + * continuous manner + */ static inline bool sdhci_buff_access_is_sequential(SDHCIState *s, unsigned byte_num) { @@ -1206,8 +1218,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t va= l, unsigned size) MASKED_WRITE(s->argument, mask, value); break; case SDHC_TRNMOD: - /* DMA can be enabled only if it is supported as indicated by - * capabilities register */ + /* + * DMA can be enabled only if it is supported as indicated by + * capabilities register + */ if (!(s->capareg & R_SDHC_CAPAB_SDMA_MASK)) { value &=3D ~SDHC_TRNS_DMA; } @@ -1279,8 +1293,10 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t va= l, unsigned size) } else { s->norintsts &=3D ~SDHC_NIS_ERR; } - /* Quirk for Raspberry Pi: pending card insert interrupt - * appears when first enabled after power on */ + /* + * Quirk for Raspberry Pi: pending card insert interrupt + * appears when first enabled after power on + */ if ((s->norintstsen & SDHC_NISEN_INSERT) && s->pending_insert_stat= e) { assert(s->pending_insert_quirk); s->norintsts |=3D SDHC_NIS_INSERT; @@ -1396,8 +1412,10 @@ void sdhci_initfn(SDHCIState *s) { qbus_init(&s->sdbus, sizeof(s->sdbus), TYPE_SDHCI_BUS, DEVICE(s), "sd-= bus"); =20 - s->insert_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_inser= tion_irq, s); - s->transfer_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_tran= sfer, s); + s->insert_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, + sdhci_raise_insertion_irq, s); + s->transfer_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, + sdhci_data_transfer, s); =20 s->io_ops =3D &sdhci_mmio_le_ops; } @@ -1445,11 +1463,13 @@ void sdhci_common_realize(SDHCIState *s, Error **er= rp) =20 void sdhci_common_unrealize(SDHCIState *s) { - /* This function is expected to be called only once for each class: + /* + * This function is expected to be called only once for each class: * - SysBus: via DeviceClass->unrealize(), * - PCI: via PCIDeviceClass->exit(). * However to avoid double-free and/or use-after-free we still nullify - * this variable (better safe than sorry!). */ + * this variable (better safe than sorry!). + */ g_free(s->fifo_buffer); s->fifo_buffer =3D NULL; } --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934133; cv=none; d=zohomail.com; s=zohoarc; b=PanEs0MtdqO6k9JQyBW0o9s3bHDyGw0ne0UB211vsaC7arMErqar3yGjKQVk5yu4mXX6zzEfwVrWL1UQdXcKl/blk8VtyI5zWEG2hxtAVJa99vnbx3geyr3r9VUcE3SRWAbvwjSQZGHoZLz8OlKSviaOeST2QtP4JSJYHc2Gr3s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934133; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ivNPlPth2SDoxFGmnFqTJP3RbkCwlecXTja5E4n2oyQ=; b=C9r235GY4phtK36FJzmx1nTTDvsOj1CYJ+tyKScGQWZxTAhpZlGBQaVwQAeNt3ufmRmfYhpMP4aRkhLXgBhVVXh7TkGeSvVIbi2je2c3klGDrMjKt95fZtB7LGvyS08XenK10o5nkabWoIlkIMpYfnQFy5WuhNJF88iSGsM95JI= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934133080250.4802170877325; Mon, 18 Nov 2024 04:48:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1BH-0004Y5-N9; Mon, 18 Nov 2024 07:48:42 -0500 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 1tD1AQ-00044y-Db for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:50 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AO-0005Qa-EZ for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:46 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4316cce103dso29026285e9.3 for ; Mon, 18 Nov 2024 04:47:43 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da244cb6sm161593995e9.0.2024.11.18.04.47.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934062; x=1732538862; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ivNPlPth2SDoxFGmnFqTJP3RbkCwlecXTja5E4n2oyQ=; b=LpJW46pfNKOoEuCQ/SIqWbD9LmiUwR4SSsLDLuSiHBIc2uzqC4PkR1Z6Aac+h/P39Y MQFS2zV11FjajsD7/67kohR8/eIz0fhsQNlOttKl79yaSRNM1lvp4XWJJDyVwKtOH8du NecVL4oRJbGikXFSysTFRADZFNiKHT4FE/BY4+tsRlo70DDr3UWCVamY98XPrjQ0rGwv V2A4hOF+WceYkTFk5tiohViCrDcn6HGJ6eq8IT2oOygYzK5MHg0EQq6WrZ9qUsRAFqrI 3xwy9wOLYIfXtivB9II3maOWxVbXEr3e0rRSfdEUiRINnBhKQy46WWaOIZXxn8vPZNUC HWvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934062; x=1732538862; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ivNPlPth2SDoxFGmnFqTJP3RbkCwlecXTja5E4n2oyQ=; b=B/RCGupStOUq/ZHfE/uXmBBbpqpz7nHgKHfa20g7jSxm2fmi+BWyfl614eprWyyRDa cUDOrAmwY6oqMuRKONOW3ENGxk5DMIt3TJkJtN3UT5SwhunXSRThk3uoEGZ3TUjywVh3 rCA5ZJpGeJmFkelFeJ79bi8k6J4vfbu9zmg/Dz8luUpX+4kXt06LTY2B+BOHtvc8BNPv VKUhqj7DcMLBMk8v0TKRqXa9G7UfLoyIHxWqbY3HJMYhZ6iBIotuIhVg8PPbcNr8XxMK YLK0IuD+bSIHdZWFknivQVb/jxVxQgimfALyg/FKbyqGz/FxVlShCfT3617bLypv+gzS bLPQ== X-Gm-Message-State: AOJu0Yz8lR3OxbizO7DYBH2cUBlMwZ4ovksBSWpAc4ktaeZ0jWk6MvVk iwPnlgKvC5NdwDVm30p2wprJP9v/CXO/5HkvV6kYZmQEyZ2pex/1U8urV/GUM4RmARFqqJMzScP d X-Google-Smtp-Source: AGHT+IGgCnq+uEOOEMn/m1jC1NPofGZApuhcPNDc0yz9EyYAQWH953i7rQP5LQR7qaMwyl5cqKWqnQ== X-Received: by 2002:a05:600c:1e18:b0:42c:a387:6a6f with SMTP id 5b1f17b1804b1-432df78f3c1mr121231735e9.20.1731934062603; Mon, 18 Nov 2024 04:47:42 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Mark Cave-Ayland Subject: [PULL 10/15] hw/misc/mos6522: Fix bad class definition of the MOS6522 device Date: Mon, 18 Nov 2024 13:46:37 +0100 Message-ID: <20241118124643.6958-11-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934134711116600 From: Thomas Huth When compiling QEMU with --enable-cfi, the "q800" m68k machine currently crashes very early, when the q800_machine_init() function tries to wire the interrupts of the "via1" device. This happens because TYPE_MOS6522_Q800_VIA1 is supposed to be a proper SysBus device, but its parent (TYPE_MOS6522) has a mistake in its class definition where it is only derived from DeviceClass, and not from SysBusDeviceClass, so we end up in funny memory access issues here. Using the right class hierarchy for the MOS6522 device fixes the problem. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2675 Signed-off-by: Thomas Huth Fixes: 51f233ec92 ("misc: introduce new mos6522 VIA device") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mark Cave-Ayland Message-ID: <20241114104653.963812-1-thuth@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/misc/mos6522.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/misc/mos6522.h b/include/hw/misc/mos6522.h index fba45668ab..920871a598 100644 --- a/include/hw/misc/mos6522.h +++ b/include/hw/misc/mos6522.h @@ -154,7 +154,7 @@ struct MOS6522State { OBJECT_DECLARE_TYPE(MOS6522State, MOS6522DeviceClass, MOS6522) =20 struct MOS6522DeviceClass { - DeviceClass parent_class; + SysBusDeviceClass parent_class; =20 ResettablePhases parent_phases; void (*portB_write)(MOS6522State *dev); --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934134; cv=none; d=zohomail.com; s=zohoarc; b=Qcc/qxYxu/tqVO/U6s9/7JL+ZpQcCRc8uKdpFD7guoyvswPQqYIX7eiFSU5LF7GfZvEVbliRvAougtMv7uOQvMoPC7r7RQAhlqfnxSdNCWCOlfoCEBuUuwxFf3F3ousTHkr47Ch6jc88HWWFFv8sVg8CF1NvI8pxiQQYZDwutMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934134; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vaiZ7J4o0vhrl+WvkyGBPRzIVJzJiK8smMQqcbPQEFk=; b=b2HOTpTkhzkQecFBxCEQf6AP7Y/JqU63XMQQ89iqWaonji9vaaVvcg/B45qePZE578vUjiy+2KmTtPTUaA4eF9tj6VQZtQxff3F2urytag5KoXb0bwRvubIS3FzzAU17/WrKlLKI7o0hlRYSLqAYtW8UTcwwE69783ADT31zt0I= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173193413477276.25726544390147; Mon, 18 Nov 2024 04:48:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1BO-0005KU-UK; Mon, 18 Nov 2024 07:48:47 -0500 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 1tD1AW-0004Aj-MM for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:02 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AU-0005R3-Fr for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:52 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-382456c6597so631276f8f.2 for ; Mon, 18 Nov 2024 04:47:49 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38248b74ec6sm2579263f8f.38.2024.11.18.04.47.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934068; x=1732538868; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vaiZ7J4o0vhrl+WvkyGBPRzIVJzJiK8smMQqcbPQEFk=; b=pQ+/tJorJBOJQTGgvlAptHbcfivKLHWdsfa5HOcwJZ+jkrQAe2iZ/tR52yVT0X2yYH uSTKREnLtRFLLeQrzsDR68Nb5DQupuHreSdOaJVWsOMkRhAsKiKGxjNu97yUF2SAAfeu RHVcd9+CtI+jK/huCZ9vMgc2kUu5ZxAQeSybB22INUvi69XsAqTBvAVvnkq4tVpGC5Yu M/keS9WfW16GJg7f/DL4i8yXrq/OZivdx9RGHTIznftrcsY47GUZGmmKgOXP6S/iQwVd Jt6fLNd6Ge+x76W/qOUMu1JRKp4IQdoO49jDxMri1M73wsSpY1WRSXAQrT+RsnMRyGZH 2A4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934068; x=1732538868; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vaiZ7J4o0vhrl+WvkyGBPRzIVJzJiK8smMQqcbPQEFk=; b=iFW/o6YBJfJTHd7okRYuW/7NMHWFCwYWsPwMD8TxpkZi+MK6jQeJgq7uLK98v1GZrY 44UarBUIS4UMI3C58JKuZJU6w5sfmbvcE44dT5Ei00ywL79ON/gBdRLOOeRPEvk5E7iD 5xVDoY0dys/Js9kP2Ff17zRafFGJ9ygtq+y3ji8rDI8dH9K+1bQWay9Le4hbUpYSIDIu gGS6UC8xWpzY4bUa/MvHwkAyPUMjFe8CF7k29vH6D76G1KBNhJ9NrSkHZ0auMivZlPvf JTA7BpGV3EWstd5OA6iSDwK3TGZw/YDUSqydXFCg+SXXqPpCR/gbvZt7bthSzUYX1C4/ TI0A== X-Gm-Message-State: AOJu0YzimiY4m404pWEgIJa1Qnus2btSzg/nsGMXvC5GQVz6Ot2L7+Qc L44nG6AaNVPSGHaSmT+yCdfLlO6WVZ5apggK7leOyrbbFPtVuGHGZHtswQxdvo6vkDc9Y7DqZKV 6 X-Google-Smtp-Source: AGHT+IHwuhTtJ9EdE+hX3AFGvPR/H9Fi2JWawS4tV29H2dLJ4uE2j9nNXvRWsBtvFBFFTPwE0DskCQ== X-Received: by 2002:a05:6000:1544:b0:37d:393a:97c5 with SMTP id ffacd0b85a97d-38225a059a1mr9511199f8f.28.1731934068350; Mon, 18 Nov 2024 04:47:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , qemu-stable@nongnu.org, Michael Tokarev , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 11/15] Revert "hw/audio/hda: fix memory leak on audio setup" Date: Mon, 18 Nov 2024 13:46:38 +0100 Message-ID: <20241118124643.6958-12-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1731934136710116600 From: Paolo Bonzini This reverts commit 6d03242a7e47815ed56687ecd13f683d8da3f2fe, which causes SPICE audio to break. While arguably this is a SPICE bug, it is possible to fix the leak in a less heavy-handed way. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2639 Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Michael Tokarev Message-ID: <20241114125318.1707590-2-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/hda-codec.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index bc661504cf..74c0292284 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -472,24 +472,6 @@ static void hda_audio_set_amp(HDAAudioStream *st) } } =20 -static void hda_close_stream(HDAAudioState *a, HDAAudioStream *st) -{ - if (st->node =3D=3D NULL) { - return; - } - if (a->use_timer) { - timer_free(st->buft); - st->buft =3D NULL; - } - if (st->output) { - AUD_close_out(&a->card, st->voice.out); - st->voice.out =3D NULL; - } else { - AUD_close_in(&a->card, st->voice.in); - st->voice.in =3D NULL; - } -} - static void hda_audio_setup(HDAAudioStream *st) { bool use_timer =3D st->state->use_timer; @@ -502,7 +484,6 @@ static void hda_audio_setup(HDAAudioStream *st) trace_hda_audio_format(st->node->name, st->as.nchannels, fmt2name[st->as.fmt], st->as.freq); =20 - hda_close_stream(st->state, st); if (st->output) { if (use_timer) { cb =3D hda_audio_output_cb; @@ -760,11 +741,23 @@ static void hda_audio_init(HDACodecDevice *hda, static void hda_audio_exit(HDACodecDevice *hda) { HDAAudioState *a =3D HDA_AUDIO(hda); + HDAAudioStream *st; int i; =20 dprint(a, 1, "%s\n", __func__); for (i =3D 0; i < ARRAY_SIZE(a->st); i++) { - hda_close_stream(a, a->st + i); + st =3D a->st + i; + if (st->node =3D=3D NULL) { + continue; + } + if (a->use_timer) { + timer_free(st->buft); + } + if (st->output) { + AUD_close_out(&a->card, st->voice.out); + } else { + AUD_close_in(&a->card, st->voice.in); + } } AUD_remove_card(&a->card); } --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934144; cv=none; d=zohomail.com; s=zohoarc; b=hbLbjxXr4shbb9zzyKzB4+j1IxyUCw3kZeeIJmajyVRyP+GsYVk0aTc/rua3lRSdF+b5Na49J61plCM2p0iP9Zx072XkXw4bJCvhOEOw2NYEHd3lQQoR9MS6OzmSZo3so57uiDWFWzn1j/WabXMYUqUrNYcMx4GtYIqsFy6khaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934144; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mZY2UZXl5ISTHGaCx/dhRxaaExiBOZqSteLaMzypVhw=; b=S6N3bjzKETrM2ETE+1J1nsszMWIkm07GkPhGkaB9MFyNq1cL6MgfC2ePbwg94S+HDdYtMy/T0l2dwu0bLkOocq4SQPt0FptctPUz3tIk/8anXRwQkABcM76QtPVrx7zN8ndkj+dgXIZYdkIEsD7F8zH8sLYOBUZnNQx/3TX7CnE= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934144239559.9385770317373; Mon, 18 Nov 2024 04:49:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1BX-00065g-ME; Mon, 18 Nov 2024 07:48:55 -0500 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 1tD1Ac-0004Ei-J6 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:03 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1AZ-0005RM-Rg for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:47:57 -0500 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43155abaf0bso18088605e9.0 for ; Mon, 18 Nov 2024 04:47:55 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da28cad9sm158081935e9.32.2024.11.18.04.47.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934074; x=1732538874; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mZY2UZXl5ISTHGaCx/dhRxaaExiBOZqSteLaMzypVhw=; b=DIFQkBvb/zfEc8LqPrxIsMwrQ9ML3uAgym/lKlLqr9/X+2LUC+48CYera6qe3nUlxv CHlnzKnYEol93M3/qmh+83fBKD5pFSDLGWniYwxuGWZVpkZ69leQ2plIUbzlHn0F53kP HKoiFpZsqLVbZ1U0YUDvNYFJnZHQYnIFZhcWNWAxhoUifxvmttlCmOTTgdLdoGAatTvA eJSvwQ4newl2v/icdnr7KTy1cPxiSyasTUid8snan0Kct6sNA67Xs4FigK4SPDac6Z9D kc5X3hJkBUkyCzjfA7of/LIiG/xjw+Gj6ViotMFm1xdHRuBl5LSzt0Ao3LiC6NbaqzOl rRKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934074; x=1732538874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mZY2UZXl5ISTHGaCx/dhRxaaExiBOZqSteLaMzypVhw=; b=Kj6O1PVqJs9bmNgYrqYx97ewK/Ov3CS96I0aijQgdPddFEzGL2gK6+sUU03B+br29A o6kggVA01M4DpgY/DaROFyIm4rhVDevWX1ixFCXmz3LUlEXs4aBesH4ChrubDGqsJH6b jNmk5kcqMqOeOHBSQFHdVwJJfAP/UFyjJ3Xk/d5lrKXBaN9E0Nmy0NUTSQJkkpAkIqhv 21IaixSIfOgob7WPZuL7y5CJ04cJiMoMItjsW1q1ifbpJaidd1xkxXIIrpB6H2xflE1F o6ZJ8NhLs8cpLh10pu9GcJzr/hXubd1wkL8KJWBDOQyDwxQaWSufr+eVa/tgsQxDJlFu hD2Q== X-Gm-Message-State: AOJu0YwiQiOoNp6v1V2dxY3wXN/32WaMMbTkCyEH6tSM6bf64rFJ9zOo 5ZDlt1ZQERwCvLPMpMv2Ep19bzmWgbWHSFBnBM7hH95BU0QjBg9eViso1gqB5mGO8PVDtr3sqXL J X-Google-Smtp-Source: AGHT+IFWseHO7AxXi8DCnPAmK/DSPyYuGVEk+4RungkkyCu1GUZjKkq1wwr2n3Hq66WurevDi7G4Eg== X-Received: by 2002:a05:600c:3143:b0:431:9397:9ace with SMTP id 5b1f17b1804b1-432df7411b0mr120048115e9.10.1731934074124; Mon, 18 Nov 2024 04:47:54 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , qemu-stable@nongnu.org, Michael Tokarev , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 12/15] hw/audio/hda: fix memory leak on audio setup Date: Mon, 18 Nov 2024 13:46:39 +0100 Message-ID: <20241118124643.6958-13-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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 @linaro.org) X-ZM-MESSAGEID: 1731934145108116600 From: Paolo Bonzini When SET_STREAM_FORMAT is called, the st->buft timer is overwritten, thus causing a memory leak. This was originally fixed in commit 816139ae6a5 ("hw/audio/hda: fix memory leak on audio setup", 2024-11-14) but that caused the audio to break in SPICE. Fortunately, a simpler fix is possible. The timer only needs to be reset, because the callback is always the same (st->output is set at realize time in hda_audio_init); call to timer_new_ns overkill. Replace it with timer_del and only initialize the timer once; for simplicity, do it even if use_timer is false. An even simpler fix would be to free the old time in hda_audio_setup(). However, it seems better to place the initialization of the timer close to that of st->ouput. Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini Reviewed-by: Michael Tokarev Message-ID: <20241114125318.1707590-3-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/audio/hda-codec.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 74c0292284..c340a9481d 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -487,8 +487,7 @@ static void hda_audio_setup(HDAAudioStream *st) if (st->output) { if (use_timer) { cb =3D hda_audio_output_cb; - st->buft =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, - hda_audio_output_timer, st); + timer_del(st->buft); } else { cb =3D hda_audio_compat_output_cb; } @@ -497,8 +496,7 @@ static void hda_audio_setup(HDAAudioStream *st) } else { if (use_timer) { cb =3D hda_audio_input_cb; - st->buft =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, - hda_audio_input_timer, st); + timer_del(st->buft); } else { cb =3D hda_audio_compat_input_cb; } @@ -726,8 +724,12 @@ static void hda_audio_init(HDACodecDevice *hda, st->gain_right =3D QEMU_HDA_AMP_STEPS; st->compat_bpos =3D sizeof(st->compat_buf); st->output =3D true; + st->buft =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, + hda_audio_output_timer, st); } else { st->output =3D false; + st->buft =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, + hda_audio_input_timer, st); } st->format =3D AC_FMT_TYPE_PCM | AC_FMT_BITS_16 | (1 << AC_FMT_CHAN_SHIFT); @@ -750,9 +752,7 @@ static void hda_audio_exit(HDACodecDevice *hda) if (st->node =3D=3D NULL) { continue; } - if (a->use_timer) { - timer_free(st->buft); - } + timer_free(st->buft); if (st->output) { AUD_close_out(&a->card, st->voice.out); } else { --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934170; cv=none; d=zohomail.com; s=zohoarc; b=VLQgILqXqrKZEgpmnUk/c9JYUGr4JL7GAPwtcgrSzeXd93pKakeIVZgFhuRtpHlfXV8ZeXYKXBvILD9ZyCVGN2C4CtqVY3o3c8AVTQvOpq+DurKi7IWYk0a/epsBXgZ5VQMA4q7tSmFtZGyaYbM+14l99QiioV6ZIvgluzipZGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934170; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e4ERK3ElD4P8I6nFF+NaMJMN4ukbGaWKpf0tkMteE1E=; b=aBftclov7EduvmFN23FOzPH5K1s6QchD+SSftsnQjOJzWzN3wVPEq47PbW8+Awr/OAQ29eBnUUH3RoxFcW0YbYyf4rDGbTGhN+L/g9Qjcxqrxf3RPSPm+AyOI1BfckEMVT+Prk1iru7FxvSy46ySAzMegIt9WrOkACcTw42qLDM= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934170581262.7400237078522; Mon, 18 Nov 2024 04:49:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1BO-0005Cd-Ee; Mon, 18 Nov 2024 07:48:46 -0500 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 1tD1B2-0004XT-S3 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:29 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1Ah-0005Rf-70 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:19 -0500 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3823194a879so1563296f8f.0 for ; Mon, 18 Nov 2024 04:48:01 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38244ff1ca3sm3810943f8f.26.2024.11.18.04.47.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934080; x=1732538880; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=e4ERK3ElD4P8I6nFF+NaMJMN4ukbGaWKpf0tkMteE1E=; b=uCGhJvQJ8NsMdpwTKTXLIJAG+S9b3WJJfpPvg2ZTPvL6qOaOmRneJAcwnIoRax1X1d 6glAE1TgSHhPRskIq4lpF3O+ZswWdRi0i1MvvA4erpfsVdxJhA+2DIAnPiCV4Qwp/RyC TPziHyLhMG+lu5ZW0/951zYsYPFGxgMqL5D4NV5bAnZMZ96tC60qAXg/oCP0+Zl+VPPH qbvlL8oZ2AxkMlQ594q0sqY72iNht16ruxwbURT1obhTfZPc646MO6RGyqw38VT07yME cHOCvU2PHzUoVbB2rbcmrltjy8XMRG+xbuDogm6jfGJ959rNx8tyeFGpEUFM4A7uZWC2 MaRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934080; x=1732538880; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e4ERK3ElD4P8I6nFF+NaMJMN4ukbGaWKpf0tkMteE1E=; b=wXqRTAMpjIU/oHei0hbsZ8tUf8GCMVcr5GER0TqGZ5yzwOrcsBQBu8fw8kKfn4yhfv 4RQ9Tn3rFwNBEk+DyUPyJ9PnrCxPaos9I1LigjUEKDvIpPz0XOAfTl8u2RqBWbxM7rro tNGSbpbKmk8jaeY7xzrroh/FzckzuhVz1E85QQ209LwC/pVtGL1JAslCEma4mtNBAJOk A2qTWdMZmjTzRr48V8tvnjW7CTAYJjcWO4ZoTCfZyMXFgk8kqTFdjlcmadePTjV/2+lP DcZH6p5p723oR4fcn66A3TQIvrQ0Qv3F1Mt1HIGqLioJR0O41EIJAv6czIn6CEQnepWx QJDQ== X-Gm-Message-State: AOJu0YzVLbcKSww7cmuGGzbMzJ6FwfhTiVhI2/ycJd7jjgzAzmekD3K4 34CAOTxfWtH4X6/60i9k717m9c1LPz7I/NfW4Ipl57KsxkYyyfXaz/EBkTF8OIdS3ZHtU47YTkk c X-Google-Smtp-Source: AGHT+IGDo9Z850DXH8dv/QoH1s3wkaezvP+GTpZf2e8NqZYZktsOkQw0d2uqhbjTIgvkgPiZAq492Q== X-Received: by 2002:a05:6000:2a8:b0:382:372a:5718 with SMTP id ffacd0b85a97d-382372a5a17mr5566122f8f.26.1731934079649; Mon, 18 Nov 2024 04:47:59 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 13/15] hw/net/virtio-net.c: Don't assume IP length field is aligned Date: Mon, 18 Nov 2024 13:46:40 +0100 Message-ID: <20241118124643.6958-14-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::433; envelope-from=philmd@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934170895116600 From: Peter Maydell In virtio-net.c we assume that the IP length field in the packet is aligned, and we copy its address into a uint16_t* in the VirtioNetRscUnit struct which we then dereference later. This isn't a safe assumption; it will also result in compilation failures if we mark the ip_header struct as QEMU_PACKED because the compiler will not let you take the address of an unaligned struct field. Make the ip_plen field in VirtioNetRscUnit a void*, and make all the places where we read or write through that pointer instead use some new accessor functions read_unit_ip_len() and write_unit_ip_len() which account for the pointer being potentially unaligned and also do the network-byte-order conversion we were previously using htons() to perform. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241114141619.806652-2-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/virtio/virtio-net.h | 2 +- hw/net/virtio-net.c | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 060c23c04d..b9ea9e824e 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -102,7 +102,7 @@ typedef struct VirtioNetRscStat { /* Rsc unit general info used to checking if can coalescing */ typedef struct VirtioNetRscUnit { void *ip; /* ip header */ - uint16_t *ip_plen; /* data len pointer in ip header field */ + void *ip_plen; /* pointer to unaligned uint16_t data len in ip header = */ struct tcp_header *tcp; /* tcp header */ uint16_t tcp_hdrlen; /* tcp header len */ uint16_t payload; /* pure payload without virtio/eth/ip/tcp */ diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f2104ed364..75b4a28fb3 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -2049,6 +2049,21 @@ static ssize_t virtio_net_do_receive(NetClientState = *nc, const uint8_t *buf, return virtio_net_receive_rcu(nc, buf, size, false); } =20 +/* + * Accessors to read and write the IP packet data length field. This + * is a potentially unaligned network-byte-order 16 bit unsigned integer + * pointed to by unit->ip_len. + */ +static uint16_t read_unit_ip_len(VirtioNetRscUnit *unit) +{ + return lduw_be_p(unit->ip_plen); +} + +static void write_unit_ip_len(VirtioNetRscUnit *unit, uint16_t l) +{ + stw_be_p(unit->ip_plen, l); +} + static void virtio_net_rsc_extract_unit4(VirtioNetRscChain *chain, const uint8_t *buf, VirtioNetRscUnit *unit) @@ -2063,7 +2078,7 @@ static void virtio_net_rsc_extract_unit4(VirtioNetRsc= Chain *chain, unit->ip_plen =3D &ip->ip_len; unit->tcp =3D (struct tcp_header *)(((uint8_t *)unit->ip) + ip_hdrlen); unit->tcp_hdrlen =3D (htons(unit->tcp->th_offset_flags) & 0xF000) >> 1= 0; - unit->payload =3D htons(*unit->ip_plen) - ip_hdrlen - unit->tcp_hdrlen; + unit->payload =3D read_unit_ip_len(unit) - ip_hdrlen - unit->tcp_hdrle= n; } =20 static void virtio_net_rsc_extract_unit6(VirtioNetRscChain *chain, @@ -2082,7 +2097,7 @@ static void virtio_net_rsc_extract_unit6(VirtioNetRsc= Chain *chain, =20 /* There is a difference between payload length in ipv4 and v6, ip header is excluded in ipv6 */ - unit->payload =3D htons(*unit->ip_plen) - unit->tcp_hdrlen; + unit->payload =3D read_unit_ip_len(unit) - unit->tcp_hdrlen; } =20 static size_t virtio_net_rsc_drain_seg(VirtioNetRscChain *chain, @@ -2231,7 +2246,7 @@ static int32_t virtio_net_rsc_coalesce_data(VirtioNet= RscChain *chain, VirtioNetRscUnit *o_unit; =20 o_unit =3D &seg->unit; - o_ip_len =3D htons(*o_unit->ip_plen); + o_ip_len =3D read_unit_ip_len(o_unit); nseq =3D htonl(n_unit->tcp->th_seq); oseq =3D htonl(o_unit->tcp->th_seq); =20 @@ -2267,7 +2282,7 @@ coalesce: o_unit->payload +=3D n_unit->payload; /* update new data len */ =20 /* update field in ip header */ - *o_unit->ip_plen =3D htons(o_ip_len + n_unit->payload); + write_unit_ip_len(o_unit, o_ip_len + n_unit->payload); =20 /* Bring 'PUSH' big, the whql test guide says 'PUSH' can be coales= ced for windows guest, while this may change the behavior for linux --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934239; cv=none; d=zohomail.com; s=zohoarc; b=XpWZY3fN7KuJL6E8VukhpJN7kr7aegYWSv7R+IWd/sZK4Gp1GLdpQv9r2rVZDHZo++pVCgikYAf4qTOMnp3ENbnorOSL209GHb35EurmpiSQHjHtzNPOeJwYxetDhHUTu7i1kTYVc9/GgsvfKxQUcTHXeAVOLZ77FiXPBAlOMY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934239; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Imru/ZUlyc0vwa6lGwgvhqK0h2OrYCXvH3UhgPN1YaY=; b=S18jOiVkCjLYC/wAbhSYdP10krmHOVfo4nIexPsh1Fz4Hnw35hYcnconbdzsI+Jv19Wgv+crgoPn4SMWkKlu2KLRdB2b+95OW6cv9N90k9Stp1zgZf2qRw0oZ2CQ1oW/IkjZRgWndJJHa0TDB9aubPPn+vNXjt0lFyxPRjqragY= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1731934239056594.2597598430054; Mon, 18 Nov 2024 04:50:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1Ba-0006Wv-Rw; Mon, 18 Nov 2024 07:48:59 -0500 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 1tD1BB-0004c0-3I for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:37 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1Az-0005Rs-56 for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:27 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4314fa33a35so34219485e9.1 for ; Mon, 18 Nov 2024 04:48:06 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dab72141sm154245905e9.1.2024.11.18.04.48.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934085; x=1732538885; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Imru/ZUlyc0vwa6lGwgvhqK0h2OrYCXvH3UhgPN1YaY=; b=ul6KecDMMCUlCu1h5BcA/gCzcaGqJc+zYcJvQvXUEynJjDj+tmybmzxhbMLkZhxVpU CAVaK4iflU2QmrSvMdqoEdzggZUiYT0EP9CJiPiu1kTah+aR9+tDG2dAWhIrG9HbQq3M YnDhXpsaTIBADwqoz2JcgeMGYnEP50GKTP/3pY9aJt2R1QsrL81Paiww2Fq2AjInlcVN wISgGA4kLzE8klHgeJEF7u80WMsRq+6VLt9Q4yej79b9pyEWoTxSQHUN+/540pt/uTlk TTiUPK2emhQhPYDNFsYKtv+uSmN5BiqBxlofdyb/t9fIPv4jjDrZZqAu7prlZus7FU5j 0WkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934085; x=1732538885; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Imru/ZUlyc0vwa6lGwgvhqK0h2OrYCXvH3UhgPN1YaY=; b=fQtcXqQ8tOyaV2uI02yq8xfJBjGkaB2skyMe7eK4gS9cWIDerMhfJIc8nJE8P8ssOP lJQ9LjhZzxmlQEiDHVfqp5WZbjYZwCvsuE/SUUodxnd8xBOmeULGMVOiPnIqJIs83GaU zZIs8gKpe804stHyPW+L0E3La0HxdRIGc8+VuPKT3bEhV7VuJwXEXn5KuLeiHCHbOkUs cA1Z+QxqXyzhvFti61spCiJTuxxCuV/C0htD9n1hrCskBHOYjL1kTaK+CZ7aEgSgxkAh 5VTwW7Xv79Wpu3m37Fp3v7PsC8dijpMIXmO303q7x4aWeCtk7KTKED2OUhlmwCjV7OII RWcg== X-Gm-Message-State: AOJu0YzhxXKzf34DSUyqTfT+9Ex6HYg/JIKdM384DOAxt8ZKw/MIc1jN iUD8YfrBzVHyWqzOsZJX/eJHBMvPbQEaT5mwlXZ1cvM9md8xJHt9S1MW/u1TuJzoM54bi7oH+97 i X-Google-Smtp-Source: AGHT+IEWCCUlyMcimPNU7anHnu8XpmnyGwClGKjSup9I94AA0iZGPXcqmIerMVh4OpiXovD0o1Q+YA== X-Received: by 2002:a05:600c:1d90:b0:42c:a905:9384 with SMTP id 5b1f17b1804b1-432df791f39mr93347075e9.20.1731934085128; Mon, 18 Nov 2024 04:48:05 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 14/15] net: mark struct ip_header as QEMU_PACKED Date: Mon, 18 Nov 2024 13:46:41 +0100 Message-ID: <20241118124643.6958-15-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934241103116600 From: Peter Maydell The ip_header is not actually guaranteed to be aligned. We attempt to deal with this in some places such as net_checksum_calculate() by using stw_be_p and so on to access the fields, but this is not sufficient to be correct, because even accessing a byte member within an unaligned struct is undefined behaviour. The clang sanitizer will emit warnings like these if net_checksum_calculate() is called: Stopping network: ../../net/checksum.c:106:9: runtime error: member ac= cess within misaligned address 0x556aad9b502e for type 'struct ip_header', = which requires 4 byte alignment 0x556aad9b502e: note: pointer points here 34 56 08 00 45 00 01 48 a5 09 40 00 40 11 7c 8b 0a 00 02 0f 0a 00 0= 2 02 00 44 00 43 01 34 19 56 ^ SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../net/check= sum.c:106:9 in ../../net/checksum.c:106:9: runtime error: load of misaligned address 0= x556aad9b502e for type 'uint8_t' (aka 'unsigned char'), which requires 4 by= te alignment 0x556aad9b502e: note: pointer points here 34 56 08 00 45 00 01 48 a5 09 40 00 40 11 7c 8b 0a 00 02 0f 0a 00 0= 2 02 00 44 00 43 01 34 19 56 ^ Fix this by marking the ip_header struct as QEMU_PACKED, so that the compiler knows that it might be unaligned and will generate the right code for accessing fields. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241114141619.806652-3-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/net/eth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/net/eth.h b/include/net/eth.h index 3b80b6e07f..14c34f530f 100644 --- a/include/net/eth.h +++ b/include/net/eth.h @@ -56,7 +56,7 @@ struct ip_header { uint8_t ip_p; /* protocol */ uint16_t ip_sum; /* checksum */ uint32_t ip_src, ip_dst; /* source and destination address */ -}; +} QEMU_PACKED; =20 typedef struct tcp_header { uint16_t th_sport; /* source port */ --=20 2.45.2 From nobody Sat Nov 23 18:20:55 2024 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=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1731934170; cv=none; d=zohomail.com; s=zohoarc; b=TZeTJ1Qk0MRv9h6O5hQzoC/RzaiNbFhS+zjHYbbCT9cEyjLjUvN37b+i3vW4KVAuzwxYnyVRRi94y33TaW5ACgoG/1HYEl7CnFiwSH6n+BMwAI8aUxX6oer0hYeLe/zxfet7Ev76ZUDeO9ANKne2fuv9YOzEwyJIOLp3JsdPrE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1731934170; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vThzEj5/0y6fC/Z7sKZAT6Xu5p270O8pYo+gkBmXMu4=; b=lSAaPGFPtaBounhjjPpK0P50tOpdyHJxwor6qhrZAw0VnGBP9wa+whTP/Z0VlmtLlalq9HCC/xhZ11uPECrbxxrxm/w6eYc/GBB53ejZd50KgQEalqxZ0YhfXrDaifU0WJu4Ol0e02oU0l8PyV9kTl8aj9nygJUQsQ0V+xNU/fc= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173193417048323.76194500384861; Mon, 18 Nov 2024 04:49:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD1BU-0005dA-38; Mon, 18 Nov 2024 07:48:52 -0500 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 1tD1B2-0004XV-Se for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:30 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tD1Aw-0005SC-Gw for qemu-devel@nongnu.org; Mon, 18 Nov 2024 07:48:21 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43169902057so34282065e9.0 for ; Mon, 18 Nov 2024 04:48:12 -0800 (PST) Received: from localhost.localdomain ([176.187.198.1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-382371a5646sm7362071f8f.0.2024.11.18.04.48.09 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Nov 2024 04:48:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731934091; x=1732538891; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vThzEj5/0y6fC/Z7sKZAT6Xu5p270O8pYo+gkBmXMu4=; b=CMgsvkmcUHQOQpyONJGDbpx7VB6ieLu1c1mlxekPa6hhqDtUXHczDW3QxRyIF5Qi9f jbQ4CA0G6BbYMLLI4J65+o8w5zjx6LWfRgS0fxdOqVoVYZ4zBTCJtpus5vCdmcrf4kel Y2vbDtDPFDRMK6QpPSl67WtEtuT8YFootBSePWreDTaUqCOO7/G+tVrnXfZozh8VsXZE tGo+kyQasU+OOeLKQPqty/F3J1KceF5NJizGrEy28IauWBsyH+NdQUh52P3/Ve+lD12N DQ4XOGgIWTzf13v0mWBU5mO5ih4xxA4YiB40H/rpj7+J4ShGU62VmemyGn1zEn9WwCRo 4hRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731934091; x=1732538891; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vThzEj5/0y6fC/Z7sKZAT6Xu5p270O8pYo+gkBmXMu4=; b=f+QkbXda942P6/mD+3J97BmTt/8sh2rY3uYfXdeHJCrWOK4kA+tpFeZJ66tE5NWA24 QaPBYEKElsf0K2VbAO1cZO/+hBP8ryBPKtXSxpfhFAGc8p+AmEgWGy3btQSGG1wk2iyp 3DPQ0ZvL4sg05571GSicB/tmrTWaRV9CJqvP0Lk9zm6poHmYs+IoacqQN9u4lR9cYmRu I0r6IVtFFXsZjIQGjSa55oP2FSZPFeqL0WQxgpIoS4jufues2r22SBdMf1G6CnW/VXEZ 1U9ERBvR/ioyaDmZ7na/RJF3JDWapmhc0B9jPwzdWjGnzwns6dR6E99BSEmKD6gtFMVN 59JA== X-Gm-Message-State: AOJu0Yw0w/KU+68ZznIUyBLCUU2tsMH1HjChh0AZensCIX5yVpfeRCI1 Ke1YRqVlsaPrWbMsi5ct4DbMYmGPdPL1ASBo5+EQLSPaV9QfA0jff9nBum5aoqfm1AV3LjaRlLk y X-Google-Smtp-Source: AGHT+IH/Qpx9anm36693kePwO9l3q51HFtofTN2RTonKp8PeJDRuNCQXSnvTuS8pimYG6bn+95KU6Q== X-Received: by 2002:a05:6000:2c6:b0:382:1c58:5787 with SMTP id ffacd0b85a97d-38225a89fe4mr11523224f8f.46.1731934090708; Mon, 18 Nov 2024 04:48:10 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Roque Arcudia Hernandez , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 15/15] hw/watchdog/cmsdk_apb_watchdog: Fix broken link Date: Mon, 18 Nov 2024 13:46:42 +0100 Message-ID: <20241118124643.6958-16-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241118124643.6958-1-philmd@linaro.org> References: <20241118124643.6958-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.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 @linaro.org) X-ZM-MESSAGEID: 1731934170850116600 From: Roque Arcudia Hernandez The patch changes the comments to point to the latest Design Kit Technical Reference Manual. Signed-off-by: Roque Arcudia Hernandez Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20241115160328.1650269-2-roqueh@google.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/watchdog/cmsdk-apb-watchdog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/watchdog/cmsdk-apb-watchdog.c b/hw/watchdog/cmsdk-apb-watch= dog.c index 7ad46f9410..e4d25a25f7 100644 --- a/hw/watchdog/cmsdk-apb-watchdog.c +++ b/hw/watchdog/cmsdk-apb-watchdog.c @@ -12,8 +12,8 @@ /* * This is a model of the "APB watchdog" which is part of the Cortex-M * System Design Kit (CMSDK) and documented in the Cortex-M System - * Design Kit Technical Reference Manual (ARM DDI0479C): - * https://developer.arm.com/products/system-design/system-design-kits/cor= tex-m-system-design-kit + * Design Kit Technical Reference Manual (ARM DDI0479): + * https://developer.arm.com/documentation/ddi0479/ * * We also support the variant of this device found in the TI * Stellaris/Luminary boards and documented in: --=20 2.45.2