Skip to content

Commit b5d1b4b

Browse files
Dan Carpenterbjorn-helgaas
authored andcommitted
PCI: dwc: Fix a 64bit bug in dw_pcie_ep_raise_msix_irq()
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: 2217fff ("PCI: dwc: endpoint: Fix dw_pcie_ep_raise_msix_irq() alignment support") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Cc: <[email protected]>
1 parent 6613476 commit b5d1b4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Author: Kishon Vijay Abraham I <[email protected]>
77
*/
88

9+
#include <linux/align.h>
910
#include <linux/bitfield.h>
1011
#include <linux/of.h>
1112
#include <linux/platform_device.h>
@@ -551,7 +552,7 @@ int dw_pcie_ep_raise_msix_irq(struct dw_pcie_ep *ep, u8 func_no,
551552
}
552553

553554
aligned_offset = msg_addr & (epc->mem->window.page_size - 1);
554-
msg_addr &= ~aligned_offset;
555+
msg_addr = ALIGN_DOWN(msg_addr, epc->mem->window.page_size);
555556
ret = dw_pcie_ep_map_addr(epc, func_no, 0, ep->msi_mem_phys, msg_addr,
556557
epc->mem->window.page_size);
557558
if (ret)

0 commit comments

Comments
 (0)