Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp464863lqz; Sat, 30 Mar 2024 04:38:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV/Bo2/4M0Uc3RM6111yKbA5xO1STZhhmwLoWhU4d2Ofk4M0gOQAE5B+HKusNKVzFNrASdRGh/Y5AKg8IBm1Q5CPJQLhUVA2AwaM11Uvg== X-Google-Smtp-Source: AGHT+IGn5IPo1d7uPd+kpiEUTCmEw7xmta3thkG7O/LpQboaQwT9C8z4TlYJK+kvOaiJlG7hwArL X-Received: by 2002:a17:906:3a91:b0:a4d:f555:fd6 with SMTP id y17-20020a1709063a9100b00a4df5550fd6mr2722002ejd.29.1711798728979; Sat, 30 Mar 2024 04:38:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711798728; cv=pass; d=google.com; s=arc-20160816; b=TU2M/FHQgW74XUjYX8xd4hfhFJBVQne+8/MXbbGHsrkKj/kKo9iNfKa9rPkjpaNqqM FH7Bwy5BPmOK7jT03jMWyCJqatBxUPvuK0ujC0GEUByQ6TRLbImVdaJE1lPJYxpnRNvp HzDDPcAtFC3znrVFSJQBrIo5pla1qEhdXm6EQ+UH1FPpjjf7sfH5LBDhC82mKcZ0dbYj QzkLpM4JUoBxaD4up1+yuZ374lXAP8MwVtqrWc5jbxfoRnryN+FVSHN+4LyPjHjsTCF9 Ev+Ul7MzWW3QnfClWWXeBgdabGAlm0Wp8IJLrtc2r4zQVlzfKd7QJ/9PbG+tQw/c/yjs wd+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:feedback-id :dkim-signature:dkim-signature; bh=Z1Dd2tJZMkiVybemOt34k95e05/iiGNB8NyRWIf1KjE=; fh=DcHjOHBCN2c7hG6KoW9VLiKRLaT3xdycxCBoK39WmQA=; b=GSQqc6FM/rAmpDXxLNRFcHrGPgUWmd7EQL4/ShjB9uwkFHlLqkdrPgi7wm5dYsQwB6 mPqfQ/L7q9eArXtWVMoLKt7DD0OjIjps69Ew+v9X2hMxCa1jUUcHo4mbVUzL/0E7C5YQ 6reD3CZ6Pi6TsWLDqRFtCKiYV2ZlYOUQWaIsLotf1/16uqucJ+9PK2ml6DNgawedt34R FDfB87rEgoIHRTHQAA/N/tBdjSaixXqG3vCrnyXd4PMy+mIHPfHdYIVlOmacDr/do0rG n88dmLqZXfhNQwY9Wb+GYE05ZslJgNv8RqnqP7HpYglH2qjBMUtq4beeGqNZHZchgBuf SuPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b=qUbOKDYj; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=ma1aHrfh; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-125707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125707-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id pv16-20020a170907209000b00a4e4ecb1491si442667ejb.1029.2024.03.30.04.38.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Mar 2024 04:38:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=fm3 header.b=qUbOKDYj; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=ma1aHrfh; arc=pass (i=1 spf=pass spfdomain=flygoat.com dkim=pass dkdomain=flygoat.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=flygoat.com); spf=pass (google.com: domain of linux-kernel+bounces-125707-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125707-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8B83B1F223E1 for ; Sat, 30 Mar 2024 11:38:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 695312E63C; Sat, 30 Mar 2024 11:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="qUbOKDYj"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="ma1aHrfh" Received: from fhigh8-smtp.messagingengine.com (fhigh8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6F1C17FB; Sat, 30 Mar 2024 11:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711798724; cv=none; b=IFD3KhS43/XnH9yWNW19aNc0TkxXRTMxjbfx2UMIqO5G0WNwGVUhrOPDLYZt6SQnkNs//QnZI0jiXH26Rzt+tV8t0kzrvnUDbWI1zoYGd2EEx0x3vXNP1qG5FqnaFSyaoTrVDdQMbvi+R76KRcQOig8soRdKilXbxxFo7YRlJPs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711798724; c=relaxed/simple; bh=z0uo46mKQ+RNZgsyFQouiDEjhYodSebsHuzd5wlqUss=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bcZ4Trd1bqrnjgCFGlVphshBgjOrCVQv4LbhgQG530dZCdV4zfadT8cHcSqBHJ/qRyiFa0WaACxVgopZqZmn3YdjbFl+lPtREHwuWcKK6HVPlGaDzCoyvAK8NWEC/NNW6YikE9XmDnTE35E87uEYWacg07XVJlBOfB9WTuBoomE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=qUbOKDYj; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=ma1aHrfh; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 8BA3711400A7; Sat, 30 Mar 2024 07:38:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 30 Mar 2024 07:38:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1711798721; x=1711885121; bh=Z1Dd2tJZMkiVybemOt34k95e05/iiGNB8NyRWIf1KjE=; b= qUbOKDYj+PFY9fXLEX6Mz17/E6SbBGxS11d7urxyBUnWAFA+Ho/ttQ60lkFIbHd3 ZumeYUnJbo8FAtaAhkq3pK+DQcM8uD3RYzRL4uf0wpfd6YcW5r68pk0C3QaVTsZe XqtbvrfobTS7Ql66f8ALf/88k1tRIj37HXCh23leyvK6SIm/J3zCPnwyWOZ8WNAX kCYyXjuCAXDH7aS2jlQIuRqfbTVSbWWT8DjLtDKTa+RZiD2g6g+DVzK3V2yAav4h pxDG0h2sCrwsf1VHdiGnFMtc8MGfeXnTJ03PUK3u7HGbow6Zb8+EnLcvlljl1iUH 5BtMUAWUkieNcnV/rn7j6Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1711798721; x= 1711885121; bh=Z1Dd2tJZMkiVybemOt34k95e05/iiGNB8NyRWIf1KjE=; b=m a1aHrfh5k7qY5VD/j7eltOYaqjVr3YxLMEMJJpiOBPYCgAlh2zU1wgD5tRulrjqN mgHrZ+7rKgNxWihnaByPQikds6A7pz0gpYzZ+E2fu55X0tsOAgDuInfsKsO95Ciw M/4QYNDR7JiSLS4rqR3kZ+nJ5VTdxMDVW1SZjuFNAMczut8GgdLZ/AqG4uWlDuI9 3U6VnvR4cH+lB5eCwWoAX/J9jLBkzk6qkeUYEHhbG4luRIzdQafB1VEVmG2XA2o8 xs+3ZK7r+bLJYe/gC2eC7BJdf+mCybgvGs32+p1gxHq59jFu2KmBtODLWEv9IWkf TeDczdGwt+nZzMkG8DBFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddvhedgtdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeflihgr gihunhcujggrnhhguceojhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomheqne cuggftrfgrthhtvghrnhepleeuffehheegleeuvdelgffhueekjeetueevuefhffdtgfeu hfeggfeukefffedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepjhhirgiguhhnrdihrghnghesfhhlhihgohgrthdrtghomh X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 30 Mar 2024 07:38:40 -0400 (EDT) Message-ID: <71eda6f7-0455-48ee-82b6-33f9e631f3d0@flygoat.com> Date: Sat, 30 Mar 2024 11:38:40 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] irqchip/loongson-pch-msi: Fix off-by-one on allocation error path Content-Language: en-GB To: Zenghui Yu , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, maz@kernel.org, wanghaibin.wang@huawei.com, Huacai Chen References: <20240327142334.1098-1-yuzenghui@huawei.com> From: Jiaxun Yang In-Reply-To: <20240327142334.1098-1-yuzenghui@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2024/3/27 14:23, Zenghui Yu 写道: > When pch_msi_parent_domain_alloc() returns an error, there is an off-by-one > in the number of IRQs to be freed. > > Fix it by passing the number of successfully allocated IRQs, instead of the > relative index of the last allocated one. > > Fixes: 632dcc2c75ef ("irqchip: Add Loongson PCH MSI controller") > Cc: Huacai Chen > Cc: Jiaxun Yang > Signed-off-by: Zenghui Yu Reviewed-by: Jiaxun Yang I copied that piece of code from another driver without thinking. Good catch! > --- > drivers/irqchip/irq-loongson-pch-msi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/irqchip/irq-loongson-pch-msi.c b/drivers/irqchip/irq-loongson-pch-msi.c > index 6e1e1f011bb2..dd4d699170f4 100644 > --- a/drivers/irqchip/irq-loongson-pch-msi.c > +++ b/drivers/irqchip/irq-loongson-pch-msi.c > @@ -136,7 +136,7 @@ static int pch_msi_middle_domain_alloc(struct irq_domain *domain, > > err_hwirq: > pch_msi_free_hwirq(priv, hwirq, nr_irqs); > - irq_domain_free_irqs_parent(domain, virq, i - 1); > + irq_domain_free_irqs_parent(domain, virq, i); > > return err; > }