Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp19916ybh; Tue, 21 Jul 2020 15:13:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBulecrt0YxqCfCrUqy65HWjk0QdU18gObrvJDsgpFfXu3sYeWwBCyHlf1e4zDLJemlo+S X-Received: by 2002:aa7:c2c5:: with SMTP id m5mr28343988edp.214.1595369614066; Tue, 21 Jul 2020 15:13:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595369614; cv=none; d=google.com; s=arc-20160816; b=LA4VWNE6fKzENmoOxoS2uxqF929HOtdsu1WUuDZiP7A8MuCcZyfJrH/80vxsVyyRRH 2VVIbpr2zLv7TgJmu8AJwGZ90Mh/0iPIvQj7hn2ouKWch6A2UBGnNprFutIAN0kZnjEh LLCf1EmAOaxxOX8uZvFb1v5vWbKSvliok2zAUuSD3H73DYKmoiVrE3WXmSkFEmrxUM1I KQOt797aaWCWuBKW1SqPOCh3jEaUrp8tEUKf94cAvSEEE5b1fcj5ThF+Zcxv8aChgWQd td5cDmf7UGcboQ4NaiUDgmVpJSntPOzQC3fOeTLAtlEZQLWwPKbSsJlMWa+dIUGd1kJF aG/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=9ajmmlN4I8XJ8EZDSqXRyOSYYe0jPYLNG9D0a0OQjD8=; b=zT1bbeLjbuGjOwA61BTdMOnhGeyT+T7ivTkE5RfGLfk0CqkwZn7DB/b0dHN2lII4dl 9bDsB41F7njC4M9GTSqoIG/wO6ITRDyIrXbv+FWpPtND/n04KiVY7A5IUKgnmTAVkzrT fm1Pae3lFt0sXY8selbin+p2UosqtIwFt/ZrLczEjqkqd4rWjYXlV5Ny7HbjNXmV9Gti gi9veI6D1oshOgPOC/xjet9rW/0xY1lowiVK5WTyg1gypQVK4cX8fjjSV2qSwEG+CmAe DM1VwRa0RuvvQmut7aOk6v6mWY8tn4KLPQueSoMfFSFgY6T8TQkuWCcuOW89pfiCBr+y P+2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="I/T/JAJu"; 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 z13si12719454edr.106.2020.07.21.15.13.11; Tue, 21 Jul 2020 15:13:34 -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="I/T/JAJu"; 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 S1729089AbgGUWMy (ORCPT + 99 others); Tue, 21 Jul 2020 18:12:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:47984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726686AbgGUWMx (ORCPT ); Tue, 21 Jul 2020 18:12:53 -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 0005020717; Tue, 21 Jul 2020 22:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595369573; bh=dI9lxg58mjt0Vo60nW5Ycuenb3uhXCAR65ohWNLBhS4=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=I/T/JAJuBiE5B7+bWgqxLEL/wIxAmm5LpWcCGwR20MNg7LBKmtL+VWlV6Cfj7QmrK T4UJl7jjdx3a3KyQJJlTe77bbPwZHG6/ynI+NNuY9INqcY0DBbA2DjGbTRetMP1qA+ DjTGHTlTwjtO6v2YCYy4eIRCWLhq7AjxqJiECnyM= Date: Tue, 21 Jul 2020 17:12:51 -0500 From: Bjorn Helgaas To: Jason Wang Cc: linux-kernel@vger.kernel.org, Bjorn Helgaas , "Michael S . Tsirkin" , virtualization@lists.linux-foundation.org Subject: Re: [PATCH 2/2] virtio-mmio: Reject invalid IRQ 0 command line argument Message-ID: <20200721221251.GA1164301@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <032d0424-4876-6322-76d2-d733db28addb@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 02, 2020 at 11:06:11AM +0800, Jason Wang wrote: > On 2020/7/2 上午6:10, Bjorn Helgaas wrote: > > 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; > > Acked-by: Jason Wang Thanks, I applied this to my for-linus branch for v5.8.