From nobody Tue Nov 26 15:27:25 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1706535192; cv=none; d=zohomail.com; s=zohoarc; b=APgMqhz+EeCQQTre/t6VIxE5jBUNoUxb3qhkHIurLGKIR+L10HVcSk7LfTuLgd5XhEVQrSIXz4qutXFpeFIxypM9HB5LsBDxs+tc0HjyVk8es5QfEJrEMwnZziJFHeG6DKEdCI+C5r7Qya8Z+6oExekaqJ9ECvkr5Aar7a3AHxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706535192; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=9Ku+HrGPXjToZDgNgsmKEWcHlzJmRB3FkB2Wo+Oy33Y=; b=IUXJfdL+gr+Z+i8rE+Gmb1IH067T3IKA+dqCb/w7eZ1NuV2+4Eii/CAxpKKZOqmG6pzsi85xw8Q/vgDTW6vj4nNgLU/VKE+2ksEEpxPQQ/0iDYkN0PyAGabPg/l6uylE6GMNyQnzaeutyylnqefg9GMRjHHnUIiVUJXMS18X+EE= 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 1706535192055721.133242427249; Mon, 29 Jan 2024 05:33:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rURky-0006KU-CJ; Mon, 29 Jan 2024 08:33:03 -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 1rURku-0006JO-JL for qemu-devel@nongnu.org; Mon, 29 Jan 2024 08:32:57 -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 1rURkt-0007SY-4j for qemu-devel@nongnu.org; Mon, 29 Jan 2024 08:32:56 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-DQqhvIWMPg-Ej9IfL9z3UA-1; Mon, 29 Jan 2024 08:32:52 -0500 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a35384ae3beso93336566b.1 for ; Mon, 29 Jan 2024 05:32:52 -0800 (PST) Received: from [192.168.10.118] ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id k15-20020a1709065fcf00b00a2cea055d92sm3957718ejv.176.2024.01.29.05.32.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 05:32:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706535174; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9Ku+HrGPXjToZDgNgsmKEWcHlzJmRB3FkB2Wo+Oy33Y=; b=iJSAL2Xrq6fNtf+KSHf4hYCV8mQ4QP7H9U58/7npkCC26Set9C9rEw2gwQQSu7J4KoBNtT itio/7Mswqi6WhQTtwzF7SvF+meCVcvdxPX317u2RgM+YXyquJJd7aeNysi67aRwAo4f3G RmrcsZdNUowapQKhsPAyiZ/lGGfiu+A= X-MC-Unique: DQqhvIWMPg-Ej9IfL9z3UA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706535171; x=1707139971; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Ku+HrGPXjToZDgNgsmKEWcHlzJmRB3FkB2Wo+Oy33Y=; b=RRyjQCndS79IXCUoMbGUZ2uwg+3l4y+VOh9ZRpvnRuvcMQZzqw8r+k0SBy/9vFyhKb SaM78fJhQureVyjmP7AZkF8kVrgIKJrKXw0hxPX+3Um80k/9mfEEOOsV0qTBqbJeMb0d +VmX48paDn29Fr9EEP465M8bfysdkz6aYcEzb1ARchS+NaXcWCkKY+0tXiEgKbCOgClZ 9rEkqGZWNYjtOkHJI/hRsdvalJGf18zjy2TFxe2rAUDMFp6iqEYxEwFlvO7bsNI3Lns8 CESnbFac8anupQu/bs5Ko9NMsUB9iBaBOPFUNjJvnGvGAm2KH9HL0CSpAOYboW22HOWA OIiQ== X-Gm-Message-State: AOJu0Yx02v9iN4GtaDxNcu6rLqrYddcjVutOX4OneFqvr9wPjyuTtg9V /+RARdsctqwqi5q/249gql+o9yo2jjL8iUaZDCsFo4tVffsNF0DqTUtyQNLTcPulv1fut2H19/I KmCREHgJBQoqvBcxl862Dcy9zUwXUCkvcrZeFsXH/FiNp341+sy1dwx0z0fXvJlRjyGHyu8uZ8X mVb7qRM/OmPs6/xCaSkTp+Ct0I6gVs1yxFr1VG X-Received: by 2002:a17:906:c1ca:b0:a35:8419:4bba with SMTP id bw10-20020a170906c1ca00b00a3584194bbamr3221512ejb.7.1706535171160; Mon, 29 Jan 2024 05:32:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7HKFt43bEgIT+79UdQSAHrNt1Gr4tzrtWaxJN4Bmies1AkTEGmv0IevHXYpU9u+b70IieJQ== X-Received: by 2002:a17:906:c1ca:b0:a35:8419:4bba with SMTP id bw10-20020a170906c1ca00b00a3584194bbamr3221499ejb.7.1706535170773; Mon, 29 Jan 2024 05:32:50 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH] isa-superio: validate floppy.count value Date: Mon, 29 Jan 2024 14:32:49 +0100 Message-ID: <20240129133249.1105704-1-pbonzini@redhat.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.29, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 @redhat.com) X-ZM-MESSAGEID: 1706535193830100001 Content-Type: text/plain; charset="utf-8" Ensure that the value is valid; it can only be zero or one. And never create a floppy disk controller if it is zero. Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/isa/isa-superio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 80e0c34652e..34df335598c 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -116,7 +116,9 @@ static void isa_superio_realize(DeviceState *dev, Error= **errp) } =20 /* Floppy disc */ - if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) { + assert(k->floppy.count <=3D 1); + if (k->floppy.count && + (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0))) { isa =3D isa_new(TYPE_ISA_FDC); d =3D DEVICE(isa); if (k->floppy.get_iobase) { --=20 2.43.0