mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
commit b5d1b4b46f856da1473c7ba9a5cdfcb55c9b2478 upstream.
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")
Link: https://lore.kernel.org/r/af59c7ad-ab93-40f7-ad4a-7ac0b14d37f5@moroto.mountain
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5552b7bf26
commit
6967ddd378
@@ -6,6 +6,7 @@
|
|||||||
* Author: Kishon Vijay Abraham I <kishon@ti.com>
|
* Author: Kishon Vijay Abraham I <kishon@ti.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/align.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
|
||||||
@@ -600,7 +601,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);
|
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,
|
ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr,
|
||||||
epc->mem->window.page_size);
|
epc->mem->window.page_size);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user