* [PATCH] MIPS: SGI-IP27: Fix use of unchecked pointer in shutdown_bridge_irq
@ 2019-03-28 13:37 Thomas Bogendoerfer
2019-03-28 14:42 ` Mukesh Ojha
2019-03-28 18:37 ` Paul Burton
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2019-03-28 13:37 UTC (permalink / raw)
To: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel
Cc: Dan Carpenter
smatch complaint:
arch/mips/sgi-ip27/ip27-irq.c:123 shutdown_bridge_irq()
warn: variable dereferenced before check 'hd' (see line 121)
Fix it by removing local variable and use hd->pin directly.
Fixes: 69a07a41d908 ("MIPS: SGI-IP27: rework HUB interrupts")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
arch/mips/sgi-ip27/ip27-irq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
index 710a59764b01..a32f843cdbe0 100644
--- a/arch/mips/sgi-ip27/ip27-irq.c
+++ b/arch/mips/sgi-ip27/ip27-irq.c
@@ -118,7 +118,6 @@ static void shutdown_bridge_irq(struct irq_data *d)
{
struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
struct bridge_controller *bc;
- int pin = hd->pin;
if (!hd)
return;
@@ -126,7 +125,7 @@ static void shutdown_bridge_irq(struct irq_data *d)
disable_hub_irq(d);
bc = hd->bc;
- bridge_clr(bc, b_int_enable, (1 << pin));
+ bridge_clr(bc, b_int_enable, (1 << hd->pin));
bridge_read(bc, b_wid_tflush);
}
--
2.13.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: SGI-IP27: Fix use of unchecked pointer in shutdown_bridge_irq
2019-03-28 13:37 [PATCH] MIPS: SGI-IP27: Fix use of unchecked pointer in shutdown_bridge_irq Thomas Bogendoerfer
@ 2019-03-28 14:42 ` Mukesh Ojha
2019-03-28 18:37 ` Paul Burton
1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2019-03-28 14:42 UTC (permalink / raw)
To: Thomas Bogendoerfer, Ralf Baechle, Paul Burton, James Hogan,
linux-mips, linux-kernel
Cc: Dan Carpenter
On 3/28/2019 7:07 PM, Thomas Bogendoerfer wrote:
> smatch complaint:
>
> arch/mips/sgi-ip27/ip27-irq.c:123 shutdown_bridge_irq()
> warn: variable dereferenced before check 'hd' (see line 121)
>
> Fix it by removing local variable and use hd->pin directly.
>
> Fixes: 69a07a41d908 ("MIPS: SGI-IP27: rework HUB interrupts")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
-Mukesh
> ---
> arch/mips/sgi-ip27/ip27-irq.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c
> index 710a59764b01..a32f843cdbe0 100644
> --- a/arch/mips/sgi-ip27/ip27-irq.c
> +++ b/arch/mips/sgi-ip27/ip27-irq.c
> @@ -118,7 +118,6 @@ static void shutdown_bridge_irq(struct irq_data *d)
> {
> struct hub_irq_data *hd = irq_data_get_irq_chip_data(d);
> struct bridge_controller *bc;
> - int pin = hd->pin;
>
> if (!hd)
> return;
> @@ -126,7 +125,7 @@ static void shutdown_bridge_irq(struct irq_data *d)
> disable_hub_irq(d);
>
> bc = hd->bc;
> - bridge_clr(bc, b_int_enable, (1 << pin));
> + bridge_clr(bc, b_int_enable, (1 << hd->pin));
> bridge_read(bc, b_wid_tflush);
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: SGI-IP27: Fix use of unchecked pointer in shutdown_bridge_irq
2019-03-28 13:37 [PATCH] MIPS: SGI-IP27: Fix use of unchecked pointer in shutdown_bridge_irq Thomas Bogendoerfer
2019-03-28 14:42 ` Mukesh Ojha
@ 2019-03-28 18:37 ` Paul Burton
1 sibling, 0 replies; 3+ messages in thread
From: Paul Burton @ 2019-03-28 18:37 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Ralf Baechle, Paul Burton, James Hogan, linux-mips, linux-kernel,
Dan Carpenter, linux-mips
Hello,
Thomas Bogendoerfer wrote:
> smatch complaint:
>
> arch/mips/sgi-ip27/ip27-irq.c:123 shutdown_bridge_irq()
> warn: variable dereferenced before check 'hd' (see line 121)
>
> Fix it by removing local variable and use hd->pin directly.
>
> Fixes: 69a07a41d908 ("MIPS: SGI-IP27: rework HUB interrupts")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Applied to mips-fixes.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-28 18:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-28 13:37 [PATCH] MIPS: SGI-IP27: Fix use of unchecked pointer in shutdown_bridge_irq Thomas Bogendoerfer
2019-03-28 14:42 ` Mukesh Ojha
2019-03-28 18:37 ` Paul Burton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.