lkml.org 
[lkml]   [2022]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] parisc: Increase the usage check of kmalloc allocated object a
Date
In the case of memory allocation failure, no alignment operation is
required.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
drivers/parisc/iosapic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
index 3a8c98615634..33de438916d3 100644
--- a/drivers/parisc/iosapic.c
+++ b/drivers/parisc/iosapic.c
@@ -229,7 +229,9 @@ static struct irt_entry *iosapic_alloc_irt(int num_entries)
* 4-byte alignment on 32-bit kernels
*/
a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL);
- a = (a + 7UL) & ~7UL;
+ if (a)
+ a = (a + 7UL) & ~7UL;
+
return (struct irt_entry *)a;
}

--
2.18.2
\
 
 \ /
  Last update: 2022-09-14 08:05    [W:0.049 / U:3.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site