From nobody Thu May 2 23:39:36 2024 Delivered-To: importer@patchew.org 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; 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=1579530493; cv=none; d=zohomail.com; s=zohoarc; b=f6XiOC/jK2udKZhE44T69T21uuQsCCQ1n3K2jdJJjjn/ENiYzwFde/YzesZPipttJwbYVzDoEjYBDh3XkOwDUOkINs8lVjjL56riZMoxtJtuERrPXTkj/cPJHA6aO13nHJ0DiO1UfdpsKYBVR4KcdsTEWTYN+XxL6Nc82lY7poo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579530493; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=b7fnyn7VZswX8TxYX4J1qJUh5P887/OHSr88SWkveho=; b=LXZdrzS17M1gae+pK61cb+CayYK96j4bDqilEQNx3cZ8N+H5Tpfb/NyWIB+IyC2IA57DVaKZGygmgKP2YexQy8ljQfekGoITa8rMQ/B9JNcL2IteeTxlQrkKH8u51mpgXHlImWJicZFX4a61QWJy7i6wJBkcw93JrtAiIBRrqfQ= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579530493834101.92692304560182; Mon, 20 Jan 2020 06:28:13 -0800 (PST) Received: from localhost ([::1]:37488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itY2G-0000pz-C4 for importer@patchew.org; Mon, 20 Jan 2020 09:28:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itXww-00029H-CU for qemu-devel@nongnu.org; Mon, 20 Jan 2020 09:22:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itXwv-0007nV-0C for qemu-devel@nongnu.org; Mon, 20 Jan 2020 09:22:41 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36250) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1itXwu-0007mY-Ob for qemu-devel@nongnu.org; Mon, 20 Jan 2020 09:22:40 -0500 Received: by mail-wm1-x343.google.com with SMTP id p17so14927797wma.1 for ; Mon, 20 Jan 2020 06:22:40 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id l18sm22873016wme.30.2020.01.20.06.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 06:22:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=b7fnyn7VZswX8TxYX4J1qJUh5P887/OHSr88SWkveho=; b=Vyahkz/P+3DzNLR+9XZIz/K7GjySh5cxlt3SxqUgX63Esnkysg5HXM1R4vJjtl3X1P dEz0e4jLjZPBohr5lkCA+l+kT1cNc/BO5Rn6d3sgpls0tDydbNUS9lKDvP/SKHE6jmXV Flv2cZCFbWZVJKzPEAXzy+Ui03uzqbIjLXVRm3tQbVL0HAkPW62HnnWxvP8rFU6utsw2 RpkmVGLHIattBthjB5JK/0RJ0irU9MfKQuiPjz2m80f3tApK+duRo+oxnFMtSWXfVxW7 dOVQaGVWTz8o/O/70uwrOfEW2z8MlgPalwOX58mYJNR2ZpasRpQrSsNuikJTS3MSQE85 Y6gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=b7fnyn7VZswX8TxYX4J1qJUh5P887/OHSr88SWkveho=; b=sD21jdIcPGxF+5SQuqI+7KnVg+VDPH7MUwYBtusx1wEXUYvUxYzANZHHGpJa1osPQU w1Z0f9BX2CGDXnNc/6E49r66kFCDrNehKwAYWc9TNMyqpOJkwf/bgSUZ+OizN9C8yzYP HzfVbWCnKixhNfj3o2ZefJ3y8PxfbYxTRgIrCqZKVZFDdoTcW2wVyEby2KcKBLKpLK8g a+NScwr7vZ2gcWGTgElybsL1JRzb8WLowyu+ZQXV4bnxcik0X7j7bN6FECl/mWXKqx9P MOVNQx70NnlGMOywKmYx1PrlHvzynnUx8FlxKKRuG53CM0KSFLntLCAy52E3isiAqmti a9kA== X-Gm-Message-State: APjAAAVySg7anTfahmDKumjOribdkMIhq9G01A0w0oiiFOOCbp8hIMj4 O3L9An8pP3gFZDubPgvKSohEjkQevQkmng== X-Google-Smtp-Source: APXvYqyZHPTmn3IAiL1n2h8pE13XoEqUHTNZ9VmuS4wRCjVJHcYO2QHbsMwV5Oa8BP8yOERlnpK78w== X-Received: by 2002:a1c:3c8b:: with SMTP id j133mr19435952wma.66.1579530158689; Mon, 20 Jan 2020 06:22:38 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH] hw/core/or-irq: Fix incorrect assert forbidding num-lines == MAX_OR_LINES Date: Mon, 20 Jan 2020 14:22:35 +0000 Message-Id: <20200120142235.10432-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guenter Roeck Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The num-lines property of the TYPE_OR_GATE device sets the number of input lines it has. An assert() in or_irq_realize() restricts this to the maximum supported by the implementation. However we got the condition in the assert wrong: it should be using <=3D, because num-lines =3D=3D MAX_OR_LINES is permitted, and means that all entries from 0 to MAX_OR_LINES-1 in the s->levels[] array are used. We didn't notice this previously because no user has so far needed that many input lines. Reported-by: Guenter Roeck Signed-off-by: Peter Maydell Reviewed-by: Guenter Roeck Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/or-irq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/or-irq.c b/hw/core/or-irq.c index 18d63831cd3..2be18333811 100644 --- a/hw/core/or-irq.c +++ b/hw/core/or-irq.c @@ -58,7 +58,7 @@ static void or_irq_realize(DeviceState *dev, Error **errp) { qemu_or_irq *s =3D OR_IRQ(dev); =20 - assert(s->num_lines < MAX_OR_LINES); + assert(s->num_lines <=3D MAX_OR_LINES); =20 qdev_init_gpio_in(dev, or_irq_handler, s->num_lines); } --=20 2.20.1