From patchwork Wed Nov 20 07:27:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13880789 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00C24D6E2C9 for ; Wed, 20 Nov 2024 07:29:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDf7g-0001yD-Mp; Wed, 20 Nov 2024 02:27: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 1tDf7d-0001xV-9A for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDf7b-00080C-O7 for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732087650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a9gy6dA9pZyQbx//Xc1zrgngdyVqqly2dozo3VuB5MA=; b=PUDZ6+2fgCcI5zbRhFWd+/l7lYNCvl/m3qdJJwk/7ji0sMDKOpktCQ3S7SXaktKlXuIZxr s08dph5+RlUrr+y8y9mrRuvEDFaUCWnTB69K0r7B/M8pBP4j44EOBOc1fGTj5qQzqJBxgx sdWFjbmy+VWtDuhLWiiS5MEo4CTFnDw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-Ynmeb4u0OIq19Ng4IuaMPw-1; Wed, 20 Nov 2024 02:27:29 -0500 X-MC-Unique: Ynmeb4u0OIq19Ng4IuaMPw-1 X-Mimecast-MFC-AGG-ID: Ynmeb4u0OIq19Ng4IuaMPw Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4314c6ca114so37949845e9.1 for ; Tue, 19 Nov 2024 23:27:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732087647; x=1732692447; 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=a9gy6dA9pZyQbx//Xc1zrgngdyVqqly2dozo3VuB5MA=; b=BPo+pcCrPgholzytyGIgiFB/vBFzBz/KCUrWCDXb9fNHwuKHhGWUHoiZBPHf5KgE01 LxWu+iFdvA0vPwZQVxFoKh8FgGFQCd86Q+v68zI9Asx7jnT9JtsZKGirSoYtsCTpN/gG o2LcyAxgnkBjptmVuUdqUvfjvxp0ocRg8tnkzcxsIuZn+BeJaQPk9w0DZQDohyIIE4/9 TI8hiHFElQmnDDdWmi2RDr2NePzlkAwPDzGOdtsF4nsc+0W3Jb1v1nslNz07ZHL9/Wiq lyuLYwI0B5lQW0J3oMWTrJHeOYLJ4ETLRd2mkjcgE99cv/8AtFGwL7fVKXB3+Dxko+mI oH4g== X-Gm-Message-State: AOJu0YyMXUwSObp/jF32ZZp6MfwZZLyxhzD0dVx7SPJXutsqFFaWI74m C+LQYQ4UyVD7HhaUHK4QUfJg9Xhim3mlwIhrsGhzjlVHHRHnlxpsR6uDV5o7HR+D07IQwBHVXfO A9KY5iv+qVbUrc3wgERfH/y3SYoQ4n92XdL0qBcftga4ZV4miDBkmnbjPDBozFiC5bajTiCZ8Ox MVSbGbByKuJu+Y5aWm2t+nw9zHScesY48BoRS4 X-Received: by 2002:a05:600c:3d18:b0:431:58bc:ad5e with SMTP id 5b1f17b1804b1-4334f025ee8mr11883175e9.28.1732087647495; Tue, 19 Nov 2024 23:27:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYmWqdBsaQnqwGJr8X6vac5RxZSoaXjkTdy5HeFad9rUVDvLop9QacpENgNvYauoDldsjVnA== X-Received: by 2002:a05:600c:3d18:b0:431:58bc:ad5e with SMTP id 5b1f17b1804b1-4334f025ee8mr11883065e9.28.1732087647165; Tue, 19 Nov 2024 23:27:27 -0800 (PST) Received: from [192.168.10.3] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433b463ad1fsm9021245e9.38.2024.11.19.23.27.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 23:27:25 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: =?utf-8?q?Kamil_Szcz=C4=99k?= , =?utf-8?q?Philippe_Mat?= =?utf-8?q?hieu-Daud=C3=A9?= Subject: [PULL 1/5] hw/i386/pc: Remove vmport value assertion Date: Wed, 20 Nov 2024 08:27:19 +0100 Message-ID: <20241120072723.103477-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120072723.103477-1-pbonzini@redhat.com> References: <20241120072723.103477-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Kamil Szczęk There is no need for this assertion here, as we only use vmport value for equality/inequality checks. This was originally prompted by the following Coverity report: >>> CID 1559533: Integer handling issues (CONSTANT_EXPRESSION_RESULT) >>> "pcms->vmport >= 0" is always true regardless of the values of >>> its operands. This occurs as the logical first operand of "&&". Signed-off-by: Kamil Szczęk Reported-By: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/ZwF9ZexNs1h-uC0MrbkgGtMtdyLinROjVSmMNVzNftjGVWgOiuzdD1dSXEtzNH7OHbBFY6GVDYVFIDBgc3lhGqCOb7kaNZolSBkVyl3rNr4=@szczek.dev Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index f9147fecbdc..317aaca25a0 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1228,7 +1228,6 @@ void pc_basic_device_init(struct PCMachineState *pcms, isa_realize_and_unref(pcms->pcspk, isa_bus, &error_fatal); } - assert(pcms->vmport >= 0 && pcms->vmport < ON_OFF_AUTO__MAX); if (pcms->vmport == ON_OFF_AUTO_AUTO) { pcms->vmport = (xen_enabled() || !pcms->i8042_enabled) ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; From patchwork Wed Nov 20 07:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13880784 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88C1ED6E2CE for ; Wed, 20 Nov 2024 07:28:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDf7k-0001yb-74; Wed, 20 Nov 2024 02:27:40 -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 1tDf7i-0001yQ-PH for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDf7h-00080d-44 for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732087656; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4+dgNF2S08viF1uCuG5gYKqJhsXnzXUAgn0oEVa0luo=; b=MpsRCFqdzRjVMtV82Cj/yAO7ZtJEBX1CfuXI+X6MNxCbTpIx1fOlVndMqcusgGNFdVbczk D9xOxoqf55NggIKNUYIrem8XG4zxZj65fHjcm1D2M5CmLKeVwnbHSbfOBRT6KRqO5gj2L1 dyezDjIfGYfh2jGN4j166znFbjk9jBQ= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-DWQrROmfNvK2MW4h1xbUHA-1; Wed, 20 Nov 2024 02:27:32 -0500 X-MC-Unique: DWQrROmfNvK2MW4h1xbUHA-1 X-Mimecast-MFC-AGG-ID: DWQrROmfNvK2MW4h1xbUHA Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-382341057e6so2088870f8f.2 for ; Tue, 19 Nov 2024 23:27:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732087650; x=1732692450; 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=4+dgNF2S08viF1uCuG5gYKqJhsXnzXUAgn0oEVa0luo=; b=cpR2ztegtz/sXlcQbMExAX+Ktp0H+tx9g0VuSfRKfm93TpsdKGuzkU7BdZ68nhX6VH mOYbcABGKmPnO1jIJl0nGye6OtaeCQtlLC+A2p61elOBVRo30lsy5cimSfaUUAhK0n42 TT7a26C5Mbb6UaP3Yd28lz4dAriR4ivJmOwfOONMEkt5oxCPTDkE1ecMXNnrvFu+aWOZ jRPGNX7PMn56aO/Ob9KEKglYzIuda450GRYD5yepMAANToavqxmmSs5TL4G8H9friZ03 ajrMchfJCpai0IbUXHnWTUMUvpNCjhn4XCS9gaEM3M2c+t5pvUZC/vZs4ZHt6i++lRwT R6Jw== X-Gm-Message-State: AOJu0YzaDWHzDlHP/WPubTigj9L2hNjLtiSFpR5yoshiw9D3+VF6AZED hiBE+XXRGQFCum5gN35tNb7sagAXJQqcoNIAlOFQHNeL7m8x2gvKWl5z1/5/hrBSqadYB86Juul gh7POTdcFyjmk3GCOd0b5WxjeifoWnVnjHv4xowkTQ+XXuRO+SRI491cMKTv4JIJFwKBv0pagsH H/p0cIxhqlns7A+9/US4TDeAgXavt41emjS0fe X-Received: by 2002:a5d:47a9:0:b0:382:372a:5719 with SMTP id ffacd0b85a97d-38254b2744emr994227f8f.59.1732087650051; Tue, 19 Nov 2024 23:27:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/L57m8jyDZkOngQdFSRFHf7T+DLi1tQ3RnIXlVbcaIY6wdZenT6+uJESPo8RXVhW8aRtyIQ== X-Received: by 2002:a5d:47a9:0:b0:382:372a:5719 with SMTP id ffacd0b85a97d-38254b2744emr994211f8f.59.1732087649641; Tue, 19 Nov 2024 23:27:29 -0800 (PST) Received: from [192.168.10.3] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490ca19sm1253766f8f.39.2024.11.19.23.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 23:27:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Pierrick Bouvier Subject: [PULL 2/5] hvf: remove unused but set variable Date: Wed, 20 Nov 2024 08:27:20 +0100 Message-ID: <20241120072723.103477-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120072723.103477-1-pbonzini@redhat.com> References: <20241120072723.103477-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Pierrick Bouvier fixes associated warning when building on MacOS. Signed-off-by: Pierrick Bouvier Link: https://lore.kernel.org/r/20241023182922.1040964-1-pierrick.bouvier@linaro.org Signed-off-by: Paolo Bonzini --- target/i386/hvf/x86_task.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c index f09bfbdda5b..cdea2ea69d9 100644 --- a/target/i386/hvf/x86_task.c +++ b/target/i386/hvf/x86_task.c @@ -122,7 +122,6 @@ void vmx_handle_task_switch(CPUState *cpu, x68_segment_selector tss_sel, int rea load_regs(cpu); struct x86_segment_descriptor curr_tss_desc, next_tss_desc; - int ret; x68_segment_selector old_tss_sel = vmx_read_segment_selector(cpu, R_TR); uint64_t old_tss_base = vmx_read_segment_base(cpu, R_TR); uint32_t desc_limit; @@ -138,7 +137,7 @@ void vmx_handle_task_switch(CPUState *cpu, x68_segment_selector tss_sel, int rea if (reason == TSR_IDT_GATE && gate_valid) { int dpl; - ret = x86_read_call_gate(cpu, &task_gate_desc, gate); + x86_read_call_gate(cpu, &task_gate_desc, gate); dpl = task_gate_desc.dpl; x68_segment_selector cs = vmx_read_segment_selector(cpu, R_CS); @@ -167,11 +166,12 @@ void vmx_handle_task_switch(CPUState *cpu, x68_segment_selector tss_sel, int rea x86_write_segment_descriptor(cpu, &next_tss_desc, tss_sel); } - if (next_tss_desc.type & 8) - ret = task_switch_32(cpu, tss_sel, old_tss_sel, old_tss_base, &next_tss_desc); - else + if (next_tss_desc.type & 8) { + task_switch_32(cpu, tss_sel, old_tss_sel, old_tss_base, &next_tss_desc); + } else { //ret = task_switch_16(cpu, tss_sel, old_tss_sel, old_tss_base, &next_tss_desc); VM_PANIC("task_switch_16"); + } macvm_set_cr0(cpu->accel->fd, rvmcs(cpu->accel->fd, VMCS_GUEST_CR0) | CR0_TS_MASK); From patchwork Wed Nov 20 07:27:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13880786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8528CD6E2CD for ; Wed, 20 Nov 2024 07:28:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDf7l-0001zE-Mf; Wed, 20 Nov 2024 02:27:41 -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 1tDf7k-0001yr-If for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:40 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDf7i-00080s-UV for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732087658; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7QhVwK8/JBtJbmVWE6jCktqNly/2uKTJAV30daTqWZY=; b=LMhAn6S1gjQqSJJs/SYFWQot926M4GJsIM53goZzaeHr64DRpKVE5q2TitaLVXfvbherUl Je+1KpKzRpIyqB1i/SUm17q/IcNJP7uJ/E2w8tT08qBr3Wc3TRrYZhqDbZS6/oIyWLAY1+ OuR4ZDyQTFcJmq3o+3TXyulD8zvUcmI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-168-VdPXurZlMkWHAbva8vSVeQ-1; Wed, 20 Nov 2024 02:27:34 -0500 X-MC-Unique: VdPXurZlMkWHAbva8vSVeQ-1 X-Mimecast-MFC-AGG-ID: VdPXurZlMkWHAbva8vSVeQ Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4316e2dde9eso38319965e9.2 for ; Tue, 19 Nov 2024 23:27:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732087653; x=1732692453; 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=7QhVwK8/JBtJbmVWE6jCktqNly/2uKTJAV30daTqWZY=; b=lN9QQqn3H5IWrRCcoXh7BWt+WxVXzyKvpLxvYU5Du9bvFvE2kCZZHYzR8r+Eyy+DAS HAEbH1F8BUo9TYFLPzWLi/v4ouPQvGjZPvFymiwXyPn217TNllNUe5AWdjZLyVJJ3NcL uOxkaKInQDfsQQvYeKVa5KOaLMYL7W6TYs86pTnDgOXVgSZ3HDlwqaTQe+jqkbKSibag hDwq/3keRjXC+Z8pA/nSnu0xqmigbL/515LMosjwRKxfp/fz8nklVEesIo51XSNkyjn5 C/hW8Lu2usKdR/F+FNqVuRS4WLoXa7xLv3+uhbh2LI6rTzpSTk5ZFxvRxAnb2tnmyiYp obSg== X-Gm-Message-State: AOJu0YzJssqtRLGXKxSRMsizDurpcXVi5GnPUSpmIz4SMw4Zxf3gU4Mf wczrU+e0/5qah2FE0bo+lOdXJuFyp8mExaYlehnspWT1SXgy+jLUwkSLAlOx5rgt890gddK9t+h ssDaxT46ht9q0iPstLxTkIxkCX4TZEommS8uaWh7hfaY/toDUKE2Z1Ua0xi3c/KE4ah2upLioyc zjwEX5g5BlwA5Z7j+8jvlI0PCDe8+sqxM+0Nzz X-Received: by 2002:a05:600c:3b12:b0:431:4b88:d407 with SMTP id 5b1f17b1804b1-433489819c0mr15946545e9.5.1732087652784; Tue, 19 Nov 2024 23:27:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4giHHmLrdNjug2Oj7rqWbaNUbzwk1D+IJsuCrjfhCkw+AxKYpWsbP0ddsAWwwEPB5YUuvcA== X-Received: by 2002:a05:600c:3b12:b0:431:4b88:d407 with SMTP id 5b1f17b1804b1-433489819c0mr15946385e9.5.1732087652368; Tue, 19 Nov 2024 23:27:32 -0800 (PST) Received: from [192.168.10.3] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433b46021e6sm9029675e9.17.2024.11.19.23.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 23:27:30 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 3/5] hw/core/machine-smp: Initialize caches_bitmap before reading Date: Wed, 20 Nov 2024 08:27:21 +0100 Message-ID: <20241120072723.103477-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120072723.103477-1-pbonzini@redhat.com> References: <20241120072723.103477-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu The caches_bitmap is defined in machine_parse_smp_cache(), but it was not initialized. Initialize caches_bitmap by clearing all its bits to zero. Resolves: Coverity CID 1565389 Fixes: 4e88e7e3403d ("qapi/qom: Define cache enumeration and properties for machine") Reported-by: Peter Maydell Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/20241110150901.130647-2-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- hw/core/machine-smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index 640b2114b42..b87637c78f6 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -290,6 +290,7 @@ bool machine_parse_smp_cache(MachineState *ms, const SmpCachePropertiesList *node; DECLARE_BITMAP(caches_bitmap, CACHE_LEVEL_AND_TYPE__MAX); + bitmap_zero(caches_bitmap, CACHE_LEVEL_AND_TYPE__MAX); for (node = caches; node; node = node->next) { /* Prohibit users from repeating settings. */ if (test_bit(node->value->cache, caches_bitmap)) { From patchwork Wed Nov 20 07:27:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13880787 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFBF0D6E2D2 for ; Wed, 20 Nov 2024 07:28:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDf7p-00020L-I9; Wed, 20 Nov 2024 02:27:45 -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 1tDf7l-0001zH-RA for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDf7k-00081l-7a for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732087659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N2F9E4mEmEirmkyQv404Dyo179Nuu2p/DO/bYOMpAzw=; b=SRITF/itIjqJx2D8VrfzTdhQUJ7EslUYa+NQLB3xsMzoJlTo5dwNR9KQ46gagJ6tbk/0Ct u0jUk4z1LAipik98xEX1Lyaw3qmg+x0d5lhTVK8A9aIbROG/gEHGH20IP3QdjW3L0pi5EF mVubkRpI+C1018pvDkpDmBwZNqVO54E= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-274-j5vmsjoWOUe7OG-nwjAAYA-1; Wed, 20 Nov 2024 02:27:37 -0500 X-MC-Unique: j5vmsjoWOUe7OG-nwjAAYA-1 X-Mimecast-MFC-AGG-ID: j5vmsjoWOUe7OG-nwjAAYA Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4315ad4938fso13809195e9.0 for ; Tue, 19 Nov 2024 23:27:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732087655; x=1732692455; 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=N2F9E4mEmEirmkyQv404Dyo179Nuu2p/DO/bYOMpAzw=; b=VCXj/d+EN6P6PnS0CSkFZnWmUf+5/ts/07jCr6zKUMmtGdgw2TPksVLzoftyA7YN4X lQnkA1sXiRxAwfbwCl/2iaKgSynH4wfORpHi+MNtjCKDVPcXvKyA6bMDi2cGpQr3aB8x wWOLgATek7aJvOBBns7U5K0PH3MRK7I7RYSSl9Gat0d3L3U2EjbWpK/OVcwYrjmJsOz9 eKuYrCZ3woNe31eJ3RqQNcdmyJkt518CMZZsiErPV0lSFAHQmeLEPFdXQEwFfIu8Vp8X Z9YmaRCj3mgOOSA+OKaT9aGc5WcFbdZR2leEj5/ykeMOdqrgX2SxFfQkRoqYis3Xy4mN hnPw== X-Gm-Message-State: AOJu0YwXmbrVSfy1ps6EtNzI4IfwHCcVe3mwwlbXRwhtUJzTR6z/Orqx wZ4FtNBCVYbnNRdUezQmpU4mH2n+xq5VdIq2sota14f/sI1val+flUkuT8Qx/I6RB3jNtq44ntz eCg4OVbzd0DJi37m7Xkp3On2+tIUoZdygwYICOUU0gVp6sMHGvXkiDaQbTtGB4bSEOggsYuUBr3 HOAOB3vtaGgGC9qOmp4xUAlQTxD7rczdWVcw9e X-Received: by 2002:a5d:64c6:0:b0:382:5206:8b5d with SMTP id ffacd0b85a97d-38254b21ac8mr976270f8f.42.1732087655183; Tue, 19 Nov 2024 23:27:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGtjKu0P42Vwo06TAVfnN7ZEI6Gu+a7HawNXdaZ81ykKy1gTB52/PeupQA/RjI90nuuPLGhg== X-Received: by 2002:a5d:64c6:0:b0:382:5206:8b5d with SMTP id ffacd0b85a97d-38254b21ac8mr976258f8f.42.1732087654777; Tue, 19 Nov 2024 23:27:34 -0800 (PST) Received: from [192.168.10.3] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433b45d4c68sm9007665e9.22.2024.11.19.23.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 23:27:33 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 4/5] hw/core/machine-smp: Fix error message parameter Date: Wed, 20 Nov 2024 08:27:22 +0100 Message-ID: <20241120072723.103477-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120072723.103477-1-pbonzini@redhat.com> References: <20241120072723.103477-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhao Liu In the loop checking smp cache support, the error message should report the current cache level and type. Fix the parameter of error_setg() to ensure it reports the correct cache level and type. Resolves: Coverity CID 1565391 Fixes: f35c0221fef8 ("hw/core: Check smp cache topology support for machine") Reported-by: Peter Maydell Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Link: https://lore.kernel.org/r/20241110150901.130647-3-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- hw/core/machine-smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index b87637c78f6..b954eb84902 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -317,7 +317,7 @@ bool machine_parse_smp_cache(MachineState *ms, !mc->smp_props.cache_supported[props->cache]) { error_setg(errp, "%s cache topology not supported by this machine", - CacheLevelAndType_str(node->value->cache)); + CacheLevelAndType_str(props->cache)); return false; } From patchwork Wed Nov 20 07:27:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 13880790 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA68AD6E2CD for ; Wed, 20 Nov 2024 07:29:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDf7q-000215-6j; Wed, 20 Nov 2024 02:27: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 1tDf7n-0001zt-Ty for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:43 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tDf7m-00086V-7v for qemu-devel@nongnu.org; Wed, 20 Nov 2024 02:27:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732087661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2rLHa2lhaD4JkWUbp9sIMcNrBEmDkALIbWpGkF72WqY=; b=Yrh/eaL+hqMOYLlRd6sH5d0OuNsQztgsVL3YYx1A+py1oB/5OYO5rMzSCoXcDvdw4pmL9C PnTfdHyozVLOBWFbeTFVEWyE56w5rMQhXcAyfJLZwvdSG85p/kT+SE09vXBhNlHoAdFHxf rZuez9ypkXKV+HfHvSOXdNUhzZHJS80= Received: from mail-lf1-f71.google.com (mail-lf1-f71.google.com [209.85.167.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-g2th1MNmO3ueSzxoG51GWg-1; Wed, 20 Nov 2024 02:27:40 -0500 X-MC-Unique: g2th1MNmO3ueSzxoG51GWg-1 X-Mimecast-MFC-AGG-ID: g2th1MNmO3ueSzxoG51GWg Received: by mail-lf1-f71.google.com with SMTP id 2adb3069b0e04-539e294566dso3838879e87.3 for ; Tue, 19 Nov 2024 23:27:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732087658; x=1732692458; 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=2rLHa2lhaD4JkWUbp9sIMcNrBEmDkALIbWpGkF72WqY=; b=v3z/NaQCYpem0qTUYB2exOg4PpV6xvvUGgshfHN9FnNfu0WxR0U8803Z1vEaUNSE7q mWHMJyUzzSW6LzSUF4Hg3qh377ElEoK8Fe47yhh4xA2/nVTQr1ztSYWlD8IBEOAYinb4 L64B9epdV3Zx1um+pj6AUSYzAH7KT+gRuwDaxIFeXUZjpbaUSVKUuL9FPLrJHEuoeBoU Aez7BUNXcnwj5UOFKN5WOlRjhBQENa+GU4hTonzIZ44Ln/gl3/HivIQ00mQLkRcd+6ES uwUyl2RaXNEf31lioCZ/8Bct4hwaNT3HlS6mQrjmQvNBnaxqoE9c7NYKxdFmO51aN/WJ Oiuw== X-Gm-Message-State: AOJu0YzIvYJkDtxN9SFWwuRSTnl8Ba29LOH+a3ncBhB1eaftwhD8Yz5a 2D134hiotaGY+RzmVWifElEWKkdOzvJYOww8rZbapYehQfxoaUGzEC9Ie6hUCShQ0JRDrwKdQBL NrNVpT94ZiBDt2chxPfLkprdrhRAeHBvEWxtph+wFY6kkH7tNbZO5UhApAvO+BDPpt5PPlpRGGm jdxjYHWGlKxFfKjQcBa5dLTWmKKdij//9Yyiav X-Received: by 2002:ac2:5b01:0:b0:539:f26f:d285 with SMTP id 2adb3069b0e04-53dc1323503mr633172e87.3.1732087658047; Tue, 19 Nov 2024 23:27:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhRVz9VYZsZd/AYl+/XTvilrzQiVez0TUuzzSwRNqUHj6o+oMnUPEX6uqNrjfjUJasZ4LH9w== X-Received: by 2002:ac2:5b01:0:b0:539:f26f:d285 with SMTP id 2adb3069b0e04-53dc1323503mr633154e87.3.1732087657623; Tue, 19 Nov 2024 23:27:37 -0800 (PST) Received: from [192.168.10.3] ([151.49.84.243]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-433b45d4ce6sm9161925e9.25.2024.11.19.23.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 23:27:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: jrossi@linux.ibm.com, thuth@redhat.com Subject: [PULL 5/5] scsi: fix allocation for s390x loadparm Date: Wed, 20 Nov 2024 08:27:23 +0100 Message-ID: <20241120072723.103477-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241120072723.103477-1-pbonzini@redhat.com> References: <20241120072723.103477-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Coverity reports a possible buffer overrun due to a non-NUL-terminated string in scsi_property_set_loadparm(). While things are not so easy, because qdev_prop_sanitize_s390x_loadparm is designed to operate on a buffer that is not NUL-terminated, in this case the string *does* have to be NUL-terminated because it is read by scsi_property_get_loadparm and s390_build_iplb. Reviewed-by: jrossi@linux.ibm.com Cc: thuth@redhat.com Fixes: 429442e52d9 ("hw: Add "loadparm" property to scsi disk devices for booting on s390x", 2024-11-18) Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 8e553487d50..7f13b0588f2 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -3152,7 +3152,7 @@ static void scsi_property_set_loadparm(Object *obj, const char *value, return; } - lp_str = g_malloc0(strlen(value)); + lp_str = g_malloc0(strlen(value) + 1); if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) { g_free(lp_str); return;