Skip to content

Commit 63b2de1

Browse files
Dan CarpenterLee Jones
authored andcommitted
mfd: stmfx: Fix an endian bug in stmfx_irq_handler()
It's not okay to cast a "u32 *" to "unsigned long *" when you are doing a for_each_set_bit() loop because that will break on big endian systems. Fixes: 3861456 ("mfd: stmfx: Uninitialized variable in stmfx_irq_handler()") Reported-by: Linus Torvalds <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Tested-by: Amelie Delaunay <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent cd49b84 commit 63b2de1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/mfd/stmfx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ static struct irq_chip stmfx_irq_chip = {
204204
static irqreturn_t stmfx_irq_handler(int irq, void *data)
205205
{
206206
struct stmfx *stmfx = data;
207+
unsigned long bits;
207208
u32 pending, ack;
208209
int n, ret;
209210

@@ -222,7 +223,8 @@ static irqreturn_t stmfx_irq_handler(int irq, void *data)
222223
return IRQ_NONE;
223224
}
224225

225-
for_each_set_bit(n, (unsigned long *)&pending, STMFX_REG_IRQ_SRC_MAX)
226+
bits = pending;
227+
for_each_set_bit(n, &bits, STMFX_REG_IRQ_SRC_MAX)
226228
handle_nested_irq(irq_find_mapping(stmfx->irq_domain, n));
227229

228230
return IRQ_HANDLED;

0 commit comments

Comments
 (0)