Message ID | c5035dc2-a379-48f0-8544-aa57d642136b@moroto.mountain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-30891-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp864624dyb; Fri, 19 Jan 2024 00:19:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEl4r6bcSXPSusElRILVdm5jyDCE7CmyQOHqLTd+X7r7iEu405nt+/fBT8KUyrYwhoUI3hx X-Received: by 2002:a05:620a:8012:b0:781:d8e1:d545 with SMTP id ee18-20020a05620a801200b00781d8e1d545mr1261173qkb.149.1705652392435; Fri, 19 Jan 2024 00:19:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705652392; cv=pass; d=google.com; s=arc-20160816; b=zP+81gku0GRyiAaxKIGyko54QUqMdcTQMIPQxKT4iaa64qCiYroWep1QZKZrP8YZl2 qPptcaoh+JQdCeYmf9FF2yMHedAwKcUXIKlFzqiVD4zgnzGpFej9YQU6LMpj2/ZepYwr dYZRA+p+uPQ4Jb/LRjxg8reD1sTb3PGsGzPIBj/IxvnnYT714YleBZDNJKANhRw6cFTG HxOynimfdlMylFeNbS6V0w9yalPXcNNfbteSUlh2g4kLiCxEVXoJhYRUnu7mqmiqoG9n 33hrWY3TdB/g1uGWpiF4JVBO6TBC5eRMx6XMqz30IFC4yTsDcJbzw9TWHan/ocT6usn1 DSwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=i23IsiSzG9RviDZ2SKH7TkJYUYoPbm9hn5rTUny/9bs=; fh=AMP6jLY/YgAkWlcuKAii2N0FHrlJK6sTn/slWMNRfkk=; b=e+b5Okr1NSWXeBMfkEPR/FdfXj3vBXe6GA9V9WPHUQEuYZFpYrXjKyjl6NWqisd7Z0 YVT4r0gEZFzp+5j4n9n1rKamX1H4DHy9mBp5omsxmmXk1l8rHKPEzbO55ilk3U0z6o0p 6QUTibmconOSG7DJ2O14fkrK1TA5OzYayT+JCfH9aeDWeDqYwVji//yBlLl953xpCgtC kp9WnduFdG7Unw6JUbVdVtbsON4oV4JJrucHT9/S5AwxF9ayRRYmeMyzEI7jDOPaKFG2 EOMyjBJ40cTbX4neWFzy5ISA4WtCAYueFGWFTa5w+4ipNuMbNx8z4nNu3tyrw5qBhgkD H01w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NU0XExYZ; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-30891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id y17-20020a05620a25d100b00783325a8cc1si16882805qko.338.2024.01.19.00.19.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:19:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30891-ouuuleilei=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=@linaro.org header.s=google header.b=NU0XExYZ; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-30891-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30891-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 3DEE91C21901 for <ouuuleilei@gmail.com>; Fri, 19 Jan 2024 08:19:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CF5A28E18; Fri, 19 Jan 2024 08:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NU0XExYZ" Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4532724B2F for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 08:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705652371; cv=none; b=I2T/1mMa5xuKTCOw5txOvktQkS0FyLMxEO/+E+V671XgFKBJ0V3QnAuxu8GJSuuZDsQMXv63p00M9LDEDywX3m5KMUU0vWeEINaGnqIiD8deqV+3RbN3EOIws54bDu5Di0croaMbfXZTP8aHjAC+hZCAwGapecX9aRkZFwzPE8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705652371; c=relaxed/simple; bh=0NtyQhvsgw43TNew/V0z84BrT4WGsBx0U3Djf9UHZeU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=ap1fyWldwlZZcuaoNRCzL2FXALF4mOAWTGE6oA144MXxwZ5y1roHFR/ZKxVawlaRgZrcwkP61Z2QIrN0SJ963rl6OQ3dSS3CtABS7YxZZF9sXP4SNi7Enk1ycGKA+MjuZU05lkEZ/eeuJyZ1JiWfTwBoXMjVRP3aCy70Zlc9Igg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NU0XExYZ; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-337d6d7fbd5so675846f8f.0 for <linux-kernel@vger.kernel.org>; Fri, 19 Jan 2024 00:19:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705652368; x=1706257168; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=i23IsiSzG9RviDZ2SKH7TkJYUYoPbm9hn5rTUny/9bs=; b=NU0XExYZxVaGGz5TbGIUPBSPX7pH1AqmFTsj2u6p8rmMMcVRr9Qzhvk+n1zCaIoX+d Zf7GLvrfwOlk4sKu/hXhAJRx9g5x/65GDB9nj2ojmCYOc0SuRNNZcSkP8MhK6gF0lCjo BBCaApnNa04e1QFU6nIcKVHuJbM53JH8v1KzQWePso0Ffs15NZQcXsm8V3aQmCdZouQn s4oHkZDzmPWYHFrirc4H3f8MlPbEvCaEoWJXKs52uL6ZHC78C4aiYsy7taGJEhYDqfcU xdX/N/tsJXaw/iW7c/rvGrUUSFdJLF9diV3vocB24b3oefmWJpWwQWE7Q+JespQ2xF7+ G33g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705652368; x=1706257168; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i23IsiSzG9RviDZ2SKH7TkJYUYoPbm9hn5rTUny/9bs=; b=mdO55uxsUX20DWZlEQAu4jqMOO6Z6FM9in8/052TX9YWMJOzuUfmkxVnpLAtEFfjmK rlF0Zj44sjI66eFb1tUvAvOHjswHFEs2QJ2HhbB9NNmPo/nDeKGK4OnVKOQlF7AeK/nd BFFCBXnfUsJXoMGGjZ4BHCF40GvLtAtL9dMiuhDB6NiTDlY0/5BnAMYQveMwJl4LwMWN QfCSGUHScaSyCPwXmMylkz3XMoQDqo26HK2rqqJ7I7e5AItu+5cbeI5z18UROCvojImo QPY5DYesV6YKsZWjRuGRH8YrcJjXMnIrxgFy2EekBKtIbzSl0H48Qi5cJx33nsbGU9k4 5U1g== X-Gm-Message-State: AOJu0YwbBdaS8ix0N/22TCdAggiFFsz3qUC1Rt7/YE8OY/eB/YmuwSe/ oBfILjPR+juYcoHLh0gYvQ2mlXy6/6VRnH2HTULn4KpWWxktFCogqSmAxcMBYwE= X-Received: by 2002:a05:600c:491e:b0:40e:4807:812c with SMTP id f30-20020a05600c491e00b0040e4807812cmr299567wmp.38.1705652368574; Fri, 19 Jan 2024 00:19:28 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id g6-20020a05600c4ec600b0040e6b0a1bc1sm21401815wmq.12.2024.01.19.00.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 00:19:28 -0800 (PST) Date: Fri, 19 Jan 2024 11:19:24 +0300 From: Dan Carpenter <dan.carpenter@linaro.org> To: Niklas Cassel <niklas.cassel@wdc.com> Cc: Jingoo Han <jingoohan1@gmail.com>, Gustavo Pimentel <gustavo.pimentel@synopsys.com>, Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>, Lorenzo Pieralisi <lpieralisi@kernel.org>, Krzysztof =?utf-8?q?Wilczy=C5=84?= =?utf-8?q?ski?= <kw@linux.com>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2 1/2] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq() Message-ID: <c5035dc2-a379-48f0-8544-aa57d642136b@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788506162673740682 X-GMAIL-MSGID: 1788506162673740682 |
Series |
[v2,1/2] PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
|
|
Commit Message
Dan Carpenter
Jan. 19, 2024, 8:19 a.m. UTC
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. Declare
"aligned_offset" as a u64 to address this bug.
Fixes: 2217fffcd63f ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
v2: fix a typo in the commit message
drivers/pci/controller/dwc/pcie-designware-ep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Fri, 19 Jan 2024, 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; Wouldn't it be more obvious to replace the entire line with this: msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size); + add the #include for it. It should handle the casting to the same type internally.
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 5befed2dc02b..2b6607c23541 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -525,7 +525,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no, struct dw_pcie_ep_func *ep_func; struct pci_epc *epc = ep->epc; u32 reg, msg_data, vec_ctrl; - unsigned int aligned_offset; + u64 aligned_offset; u32 tbl_offset; u64 msg_addr; int ret;