Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp979758ybt; Wed, 1 Jul 2020 15:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz366kemE2BzVRhqF4Cy8m6/RAEWenNn5RXkm2x9DY1kDcfHWjInGomJ1jWLByZMto4/K05 X-Received: by 2002:a17:906:fa15:: with SMTP id lo21mr26052554ejb.156.1593641660455; Wed, 01 Jul 2020 15:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593641660; cv=none; d=google.com; s=arc-20160816; b=w4vLK5T/+u3b5bXWtMycCWEubr1cL7ClSletWfVO6oRcI6K9TlkgnOLDv+w6mIzv0u ufEbz1F4a9W9NYi1SsfXUl4RsNaXWgTvSRo8IWo1AZ26+fKZbeEoUPNVIB+uGBDyfr9E vyyw0VZu0miQcnDOcilYnvPnjyrOStrSKEMIZabehjr7pSk/ngjUuN9GBRjBw7FTer4b 5PEx2ytr4Fd+pBBmu9GjByDlQVHK8pqP3kkZQhwVxcdCbYLBFJdhNVAHcuC/DrCpciz+ DmclZEyWWzUwMAVWaRMJa0tqGIbf7HhaifhMfvlxPwat7p2uUZTSqu5CRBaeTsSxEek2 ZaeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7aEM3YQHNqEkg2Zj+LX+op6HPSlb01BYn54/RxKjPiY=; b=xia9IaWycK/32LU8Asgtv1OqMXh5FHdpp+TM07YkK3E5RCIIE6VcTGLMpdmrndCslf 5AJewkEXfliHbq2kfxen8Q/QPTnHjJxmbvSfeQUX4seUuXRASt2R4Fp4aZX+VJ3rWCMw hIjEigTJs7mvib6txJ3ww35PKqY16dlXQX5CrsffoIMhmMosu3VPguQrYyKHN1tmPVyZ iuq04C24DwilICmhrrAe4mT9umu5RzIMrD0gxVAlFH02m1uEz3gAaFPlxaOD4cvNv8WL G1S0iaWHot0oVurXIsDC9OINotK8gjUY6WnnhvV+BohCwhHLnzrHVjsCY8hvA+wCUt2i aeYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U8yRMXPv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k6si4470770edn.299.2020.07.01.15.13.57; Wed, 01 Jul 2020 15:14:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U8yRMXPv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727778AbgGAWLS (ORCPT + 99 others); Wed, 1 Jul 2020 18:11:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:46944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbgGAWLR (ORCPT ); Wed, 1 Jul 2020 18:11:17 -0400 Received: from localhost (mobile-166-175-191-139.mycingular.net [166.175.191.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 22F4620780; Wed, 1 Jul 2020 22:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593641477; bh=Uu5gADrn1c8/F3DyyVDuZVDs635s6vTyqaj9liPB4zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8yRMXPv35K3avDnwhvyRBDN3TNUYAo8JSlafx8DbhjvxNvecxo6SLc034QaZPn4h lKm1OjMxsQHLbtB1FSpdDBiwsCDxCPL4QTIgMUXfOptbU2PVJLe2Oe1Rv4KuXzxI1A zhmCVHmxGbIqhYSKQE5jqPLVCYeSkWEbZptbj6Cw= From: Bjorn Helgaas To: linux-kernel@vger.kernel.org Cc: Bjorn Helgaas , "Michael S . Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org Subject: [PATCH 2/2] virtio-mmio: Reject invalid IRQ 0 command line argument Date: Wed, 1 Jul 2020 17:10:40 -0500 Message-Id: <20200701221040.3667868-3-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200701221040.3667868-1-helgaas@kernel.org> References: <20200701221040.3667868-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjorn Helgaas The "virtio_mmio.device=" command line argument allows a user to specify the size, address, and IRQ of a virtio device. Previously the only requirement for the IRQ was that it be an unsigned integer. Zero is an unsigned integer but an invalid IRQ number, and after a85a6c86c25be ("driver core: platform: Clarify that IRQ 0 is invalid"), attempts to use IRQ 0 cause warnings. If the user specifies IRQ 0, return failure instead of registering a device with IRQ 0. Fixes: a85a6c86c25be ("driver core: platform: Clarify that IRQ 0 is invalid") Signed-off-by: Bjorn Helgaas Cc: Michael S. Tsirkin Cc: Jason Wang Cc: virtualization@lists.linux-foundation.org --- drivers/virtio/virtio_mmio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 9d16aaffca9d..627ac0487494 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -641,11 +641,11 @@ static int vm_cmdline_set(const char *device, &vm_cmdline_id, &consumed); /* - * sscanf() must processes at least 2 chunks; also there + * sscanf() must process at least 2 chunks; also there * must be no extra characters after the last chunk, so * str[consumed] must be '\0' */ - if (processed < 2 || str[consumed]) + if (processed < 2 || str[consumed] || irq == 0) return -EINVAL; resources[0].flags = IORESOURCE_MEM; -- 2.25.1