Re: [PATCH] parisc: Increase the usage check of kmalloc allocated object a

From: Helge Deller
Date: Thu Sep 15 2022 - 01:45:27 EST


On 9/14/22 16:25, Rolf Eike Beer wrote:
Am Mittwoch, 14. September 2022, 11:04:33 CEST schrieb Helge Deller:
On 9/14/22 08:43, Rolf Eike Beer wrote:
Am Mittwoch, 14. September 2022, 08:18:19 CEST schrieb Helge Deller:
On 9/14/22 08:04, Li zeming wrote:

Yes, your proposal is good.
Anyone want to send a patch (with a small comment that kcalloc() will return
at least the required 8-byte alignment)?

Done.

And these functions end up propagating an allocation error in this file
and it will never reach kernel/setup.c, which seems bad.

That part I don't understand.
The return value of iosapic_alloc_irt() is checked afterwards, but you
probably meant something else?

But I guess the only point where this really can go wrong if the PDC
returns an absurdly large number of entries.

What I meant was that if iosapic_alloc_irt() fails, then iosapic_load_irt()
will return 0, which can either be "nothing to do" or "error". iosapic_init()
is void, so even if it could detect the failure, it can't report it upwards to
parisc_init(). Which is the same for basically all other *_init() calls in
there.

Ok, I see.
Not sure if that needs fixing. If the allocation fails we will be in trouble anyway :-)

Helge