Skip to content

Commit

Permalink
mfd: stmfx: Fix an endian bug in stmfx_irq_handler()
Browse files Browse the repository at this point in the history
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 <torvalds@linux-foundation.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
Dan Carpenter authored and Lee Jones committed Jun 24, 2019
1 parent cd49b84 commit 63b2de1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mfd/stmfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ static struct irq_chip stmfx_irq_chip = {
static irqreturn_t stmfx_irq_handler(int irq, void *data)
{
struct stmfx *stmfx = data;
unsigned long bits;
u32 pending, ack;
int n, ret;

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

for_each_set_bit(n, (unsigned long *)&pending, STMFX_REG_IRQ_SRC_MAX)
bits = pending;
for_each_set_bit(n, &bits, STMFX_REG_IRQ_SRC_MAX)
handle_nested_irq(irq_find_mapping(stmfx->irq_domain, n));

return IRQ_HANDLED;
Expand Down

0 comments on commit 63b2de1

Please sign in to comment.