Skip to content

Commit 8faa1cf

Browse files
Dan Carpentersuryasaimadhu
authored andcommitted
EDAC/altera: Use the proper type for the IRQ status bits
Smatch complains about the cast of a u32 pointer to unsigned long: drivers/edac/altera_edac.c:1878 altr_edac_a10_irq_handler() warn: passing casted pointer '&irq_status' to 'find_first_bit()' This code wouldn't work on a 64 bit big endian system because it would read past the end of &irq_status. [ bp: massage. ] Fixes: 13ab844 ("EDAC, altera: Add ECC Manager IRQ controller support") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Thor Thayer <[email protected]> Cc: James Morse <[email protected]> Cc: [email protected] Cc: linux-edac <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Cc: Tony Luck <[email protected]> Link: https://lkml.kernel.org/r/20190624134717.GA1754@mwanda
1 parent 3724ace commit 8faa1cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/edac/altera_edac.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,7 @@ static void altr_edac_a10_irq_handler(struct irq_desc *desc)
18861886
struct altr_arria10_edac *edac = irq_desc_get_handler_data(desc);
18871887
struct irq_chip *chip = irq_desc_get_chip(desc);
18881888
int irq = irq_desc_get_irq(desc);
1889+
unsigned long bits;
18891890

18901891
dberr = (irq == edac->db_irq) ? 1 : 0;
18911892
sm_offset = dberr ? A10_SYSMGR_ECC_INTSTAT_DERR_OFST :
@@ -1895,7 +1896,8 @@ static void altr_edac_a10_irq_handler(struct irq_desc *desc)
18951896

18961897
regmap_read(edac->ecc_mgr_map, sm_offset, &irq_status);
18971898

1898-
for_each_set_bit(bit, (unsigned long *)&irq_status, 32) {
1899+
bits = irq_status;
1900+
for_each_set_bit(bit, &bits, 32) {
18991901
irq = irq_linear_revmap(edac->domain, dberr * 32 + bit);
19001902
if (irq)
19011903
generic_handle_irq(irq);

0 commit comments

Comments
 (0)