* [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
@ 2017-01-09 8:08 Arvind Yadav
2017-01-09 9:00 ` Marc Zyngier
0 siblings, 1 reply; 6+ messages in thread
From: Arvind Yadav @ 2017-01-09 8:08 UTC (permalink / raw)
To: tglx, jason, marc.zyngier; +Cc: linux-kernel
Here, If ioremap_nocache will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/irqchip/irq-mips-gic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
index c01c09e..eeea2e8 100644
--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long gic_base_addr,
__gic_base_addr = gic_base_addr;
gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
+ if (!gic_base)
+ panic("Failed to map GIC memory");
gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
2017-01-09 8:08 [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache Arvind Yadav
@ 2017-01-09 9:00 ` Marc Zyngier
2017-01-17 10:10 ` Arvind Yadav
0 siblings, 1 reply; 6+ messages in thread
From: Marc Zyngier @ 2017-01-09 9:00 UTC (permalink / raw)
To: Arvind Yadav, tglx, jason; +Cc: linux-kernel
On 09/01/17 08:08, Arvind Yadav wrote:
> Here, If ioremap_nocache will fail. It will return NULL.
> Kernel can run into a NULL-pointer dereference.
> This error check will avoid NULL pointer dereference.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/irqchip/irq-mips-gic.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
> index c01c09e..eeea2e8 100644
> --- a/drivers/irqchip/irq-mips-gic.c
> +++ b/drivers/irqchip/irq-mips-gic.c
> @@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long gic_base_addr,
> __gic_base_addr = gic_base_addr;
>
> gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
> + if (!gic_base)
> + panic("Failed to map GIC memory");
So you're replacing a panic due to dereferencing a NULL pointer with
another panic -- not much progress here. I appreciate that the message
is a bit more explicit, but is there something slightly less drastic we
could do? Like returning an error code and see if the kernel otherwise
recovers (possibly with reduced functionality)?
>
> gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
> gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
>
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
2017-01-09 9:00 ` Marc Zyngier
@ 2017-01-17 10:10 ` Arvind Yadav
2017-01-17 10:17 ` Matt Redfearn
0 siblings, 1 reply; 6+ messages in thread
From: Arvind Yadav @ 2017-01-17 10:10 UTC (permalink / raw)
To: Marc Zyngier, tglx, jason, matt.redfearn; +Cc: linux-kernel
Hi Matt,
Please Acknowledge this.
Regards
Arvind Yadav
On Monday 09 January 2017 02:30 PM, Marc Zyngier wrote:
> On 09/01/17 08:08, Arvind Yadav wrote:
>> Here, If ioremap_nocache will fail. It will return NULL.
>> Kernel can run into a NULL-pointer dereference.
>> This error check will avoid NULL pointer dereference.
>>
>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>> ---
>> drivers/irqchip/irq-mips-gic.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c
>> index c01c09e..eeea2e8 100644
>> --- a/drivers/irqchip/irq-mips-gic.c
>> +++ b/drivers/irqchip/irq-mips-gic.c
>> @@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long gic_base_addr,
>> __gic_base_addr = gic_base_addr;
>>
>> gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
>> + if (!gic_base)
>> + panic("Failed to map GIC memory");
> So you're replacing a panic due to dereferencing a NULL pointer with
> another panic -- not much progress here. I appreciate that the message
> is a bit more explicit, but is there something slightly less drastic we
> could do? Like returning an error code and see if the kernel otherwise
> recovers (possibly with reduced functionality)?
>
>>
>> gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
>> gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
>>
> Thanks,
>
> M.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
@ 2017-01-17 10:17 ` Matt Redfearn
0 siblings, 0 replies; 6+ messages in thread
From: Matt Redfearn @ 2017-01-17 10:17 UTC (permalink / raw)
To: Arvind Yadav, Marc Zyngier, tglx, jason
Cc: linux-kernel, Linux MIPS Mailing List
On 17/01/17 10:10, Arvind Yadav wrote:
> Hi Matt,
>
> Please Acknowledge this.
>
> Regards
> Arvind Yadav
Hi Arvind,
Acked-by: Matt Redfearn <matt.redfearn@imgtec.com>
>
> On Monday 09 January 2017 02:30 PM, Marc Zyngier wrote:
>> On 09/01/17 08:08, Arvind Yadav wrote:
>>> Here, If ioremap_nocache will fail. It will return NULL.
>>> Kernel can run into a NULL-pointer dereference.
>>> This error check will avoid NULL pointer dereference.
>>>
>>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>>> ---
>>> drivers/irqchip/irq-mips-gic.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/irqchip/irq-mips-gic.c
>>> b/drivers/irqchip/irq-mips-gic.c
>>> index c01c09e..eeea2e8 100644
>>> --- a/drivers/irqchip/irq-mips-gic.c
>>> +++ b/drivers/irqchip/irq-mips-gic.c
>>> @@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long
>>> gic_base_addr,
>>> __gic_base_addr = gic_base_addr;
>>> gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
>>> + if (!gic_base)
>>> + panic("Failed to map GIC memory");
>> So you're replacing a panic due to dereferencing a NULL pointer with
>> another panic -- not much progress here. I appreciate that the message
>> is a bit more explicit, but is there something slightly less drastic we
>> could do? Like returning an error code and see if the kernel otherwise
>> recovers (possibly with reduced functionality)?
Marc, there's really not much that can be done without the GIC
initializing sucessfully. This should not happen if platform code /
device tree is set up correctly, so an explicit panic if that is not the
case is helpful.
Thanks,
Matt
>>
>>> gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
>>> gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
>>>
>> Thanks,
>>
>> M.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
@ 2017-01-17 10:17 ` Matt Redfearn
0 siblings, 0 replies; 6+ messages in thread
From: Matt Redfearn @ 2017-01-17 10:17 UTC (permalink / raw)
To: Arvind Yadav, Marc Zyngier, tglx, jason
Cc: linux-kernel, Linux MIPS Mailing List
On 17/01/17 10:10, Arvind Yadav wrote:
> Hi Matt,
>
> Please Acknowledge this.
>
> Regards
> Arvind Yadav
Hi Arvind,
Acked-by: Matt Redfearn <matt.redfearn@imgtec.com>
>
> On Monday 09 January 2017 02:30 PM, Marc Zyngier wrote:
>> On 09/01/17 08:08, Arvind Yadav wrote:
>>> Here, If ioremap_nocache will fail. It will return NULL.
>>> Kernel can run into a NULL-pointer dereference.
>>> This error check will avoid NULL pointer dereference.
>>>
>>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>>> ---
>>> drivers/irqchip/irq-mips-gic.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/irqchip/irq-mips-gic.c
>>> b/drivers/irqchip/irq-mips-gic.c
>>> index c01c09e..eeea2e8 100644
>>> --- a/drivers/irqchip/irq-mips-gic.c
>>> +++ b/drivers/irqchip/irq-mips-gic.c
>>> @@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long
>>> gic_base_addr,
>>> __gic_base_addr = gic_base_addr;
>>> gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
>>> + if (!gic_base)
>>> + panic("Failed to map GIC memory");
>> So you're replacing a panic due to dereferencing a NULL pointer with
>> another panic -- not much progress here. I appreciate that the message
>> is a bit more explicit, but is there something slightly less drastic we
>> could do? Like returning an error code and see if the kernel otherwise
>> recovers (possibly with reduced functionality)?
Marc, there's really not much that can be done without the GIC
initializing sucessfully. This should not happen if platform code /
device tree is set up correctly, so an explicit panic if that is not the
case is helpful.
Thanks,
Matt
>>
>>> gicconfig = gic_read(GIC_REG(SHARED, GIC_SH_CONFIG));
>>> gic_shared_intrs = (gicconfig & GIC_SH_CONFIG_NUMINTRS_MSK) >>
>>>
>> Thanks,
>>
>> M.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache
2017-01-17 10:17 ` Matt Redfearn
(?)
@ 2017-01-17 10:25 ` Marc Zyngier
-1 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2017-01-17 10:25 UTC (permalink / raw)
To: Matt Redfearn, Arvind Yadav, tglx, jason
Cc: linux-kernel, Linux MIPS Mailing List
On 17/01/17 10:17, Matt Redfearn wrote:
>
>
> On 17/01/17 10:10, Arvind Yadav wrote:
>> Hi Matt,
>>
>> Please Acknowledge this.
>>
>> Regards
>> Arvind Yadav
>
> Hi Arvind,
>
> Acked-by: Matt Redfearn <matt.redfearn@imgtec.com>
>
>
>>
>> On Monday 09 January 2017 02:30 PM, Marc Zyngier wrote:
>>> On 09/01/17 08:08, Arvind Yadav wrote:
>>>> Here, If ioremap_nocache will fail. It will return NULL.
>>>> Kernel can run into a NULL-pointer dereference.
>>>> This error check will avoid NULL pointer dereference.
>>>>
>>>> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
>>>> ---
>>>> drivers/irqchip/irq-mips-gic.c | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/irqchip/irq-mips-gic.c
>>>> b/drivers/irqchip/irq-mips-gic.c
>>>> index c01c09e..eeea2e8 100644
>>>> --- a/drivers/irqchip/irq-mips-gic.c
>>>> +++ b/drivers/irqchip/irq-mips-gic.c
>>>> @@ -979,6 +979,8 @@ static void __init __gic_init(unsigned long
>>>> gic_base_addr,
>>>> __gic_base_addr = gic_base_addr;
>>>> gic_base = ioremap_nocache(gic_base_addr, gic_addrspace_size);
>>>> + if (!gic_base)
>>>> + panic("Failed to map GIC memory");
>>> So you're replacing a panic due to dereferencing a NULL pointer with
>>> another panic -- not much progress here. I appreciate that the message
>>> is a bit more explicit, but is there something slightly less drastic we
>>> could do? Like returning an error code and see if the kernel otherwise
>>> recovers (possibly with reduced functionality)?
>
> Marc, there's really not much that can be done without the GIC
> initializing sucessfully. This should not happen if platform code /
> device tree is set up correctly, so an explicit panic if that is not the
> case is helpful.
Fair enough, that's your call. I'll pick that up as is.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-01-17 10:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 8:08 [PATCH v1] irqchip: irq-mips-gic:- Handle return NULL error from ioremap_nocache Arvind Yadav
2017-01-09 9:00 ` Marc Zyngier
2017-01-17 10:10 ` Arvind Yadav
2017-01-17 10:17 ` Matt Redfearn
2017-01-17 10:17 ` Matt Redfearn
2017-01-17 10:25 ` Marc Zyngier
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.