Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp62929rdb; Mon, 22 Jan 2024 12:01:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/VUYdNiBW/6tVtmWDFN+1X4S58nNo03uEqwUDEwuMw5VZmYBi+M0IJq42DsJvKFTTPvCt X-Received: by 2002:a05:6214:f66:b0:681:7e4c:c4b1 with SMTP id iy6-20020a0562140f6600b006817e4cc4b1mr7232517qvb.113.1705953667334; Mon, 22 Jan 2024 12:01:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705953667; cv=pass; d=google.com; s=arc-20160816; b=bfd1zXl3Ly51wdXgwMoOLb0RXcgwUyVCVeCr6ID8w3giDdPJeF5CxrbGWuf0oSZ35z 8Jh5rD9/P1ip9nbC9PRRnH34dEIlYasf16j8RJQ6Jghpn+efcM2FZnObbNvlaCai+3Mf XBFPv3APRNfqgK7S/y2N+GYQ+TVjzDpxfo99QxOzx3ZJNVI0xfsOkVJSduoHOKfEITuX rq/iNt5KtRyKEwkfGV4tyB9bBLBswmtD4NxktyVPFW6m4An2xOTnMRhp6/MZIRM61JpJ 67FOhKwtKZmV0vitINR5E5YPvbqCqcN6+B1Rufnnr96W0aEhG6+NJT4iJggwkxTBoGVK 4/ig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JHaib+iDc14v+TvemjH/ee6jKrgZN5t3RiNunjzPom0=; fh=oIdHDxTa4cUHteVnfd+edSLY3cKj/fvbZd8tH32asIA=; b=g3dPWoAsVcRImorf5IMSR0hadePqq+DUqUrNrypytmaRccevjY0hak34aGsp2Jw1uU A+fxLaFK/0tdu7i+ymenBcOHFUUsX+aQvrjXFARLROTtYOIgZCviPxzAnD8oQAU/k1OK 9ZYvPriNH71/peLUX0tEhxO0JIROUplvt7vyZvHI9C+JVoKgTDHqs2UgvL4fZqtdJEMS OQjM/x28teFOk/egp88SWpzd593W/1A8o7f1oa2ymwKuCjduAVTIM2FJ3srLbBq1MOds 9K6+Gm1i5RkICHe9J6F6fULnBO054PYoj6jmGMqq2ysggOL3FU5fBy7FWPSS0RdQ0Xwd y3Lg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pl3sBx1h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id l10-20020a0c978a000000b0067ed2267b72si4684374qvd.275.2024.01.22.12.01.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 12:01:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pl3sBx1h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-34096-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34096-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A79DC1C281B6 for ; Mon, 22 Jan 2024 20:00:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B141C405EC; Mon, 22 Jan 2024 20:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pl3sBx1h" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D56BB3B790; Mon, 22 Jan 2024 20:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705953637; cv=none; b=VzeJnyxEPcNmOsoI0vKun+jd2TFKZozeWdZupmZ90rQq94mzU7cHjlZbJXK3g3npBAYcs9DQIi2zJ+FMAk24qkhPmzmefkGaunU9Ff44sB4n4hPtxhTePzpMP+lcpuJXeq85f/0cj+MYvswcJYBZOSjn8EAxb8HO3QfTaZNz58E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705953637; c=relaxed/simple; bh=zSVvwnD2LANWDKYMIGKtC/aUqoKUraMfvhOhQu1rYuA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ijJHLOwo9dki/MCPEulWJ+6ENx2rZ2YRP4l+g7E3mrrZVEIhQhuIlZs5clmafLaxW2hYX8g7uhrqoONJQzMDQrH3MX8tPYXoK69JWR2+ABUSjn53sXDWhegfdsmTXqV5nh90wsf8hPF2/6v6N10tcR5QRcV5v+j8zeYjBM7A6hE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pl3sBx1h; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F412C433F1; Mon, 22 Jan 2024 20:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705953637; bh=zSVvwnD2LANWDKYMIGKtC/aUqoKUraMfvhOhQu1rYuA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pl3sBx1h9R7FS8xM5FOwXsZdDpNmIghy8nnHcpg50m7KRa2byb8exGgVut8a28qKt PfY/sQhqsAh7cvz3LMYL1Lct/GtxQWiaJuCpunV0jvxaKzb9hc+SMiBNDRhUsd7WU1 5pBwrFsETpM9dyzLDr/c1KEWm8vypI0rFSvN8RdZ/7PidlcIMpqiU6A9+o1YZ5LI/s M81uSLpk+8Uz/Oo7GkGtUj3BOEdMTWfeceKLRBh4jbA8L99jK9DlMfQmrx1rsG1dPm +IcSM89SU8XL08xcvw04hIefSpeNmvGu18cQfVVmuzmMLmB9iFFHlWYxkxTYV/U7NA NAnbYYwK9SDFw== Date: Mon, 22 Jan 2024 21:00:27 +0100 From: Niklas Cassel To: Dan Carpenter Cc: Niklas Cassel , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v3 1/2] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq() Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 22, 2024 at 06:19:52PM +0300, Dan Carpenter wrote: > The "msg_addr" variable is u64. However, the "aligned_offset" is an > unsigned int. This means that when the code does: > > msg_addr &= ~aligned_offset; > > it will unintentionally zero out the high 32 bits. Use ALIGN_DOWN() > to do the alignment instead. > > Fixes: 2217fffcd63f ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support") > Signed-off-by: Dan Carpenter > --- > v2: fix typo in commit message > v3: Use ALIGN_DOWN() instead of ANDing with ~aligned_offset (this is a > style improvement). > > drivers/pci/controller/dwc/pcie-designware-ep.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c > index 5befed2dc02b..51679c6702cf 100644 > --- a/drivers/pci/controller/dwc/pcie-designware-ep.c > +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c > @@ -551,7 +551,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, > } > > aligned_offset = msg_addr & (epc->mem->window.page_size - 1); > - msg_addr &= ~aligned_offset; > + msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); > ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr, > epc->mem->window.page_size); > if (ret) > -- > 2.43.0 > Reviewed-by: Niklas Cassel