linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] parisc: Increase the usage check of kmalloc allocated object a
@ 2022-09-14  6:04 Li zeming
  2022-09-14  6:18 ` Helge Deller
  0 siblings, 1 reply; 6+ messages in thread
From: Li zeming @ 2022-09-14  6:04 UTC (permalink / raw)
  To: James.Bottomley, deller; +Cc: linux-parisc, linux-kernel, Li zeming

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-15  5:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14  6:04 [PATCH] parisc: Increase the usage check of kmalloc allocated object a Li zeming
2022-09-14  6:18 ` Helge Deller
2022-09-14  6:43   ` Rolf Eike Beer
2022-09-14  9:04     ` Helge Deller
2022-09-14 14:25       ` Rolf Eike Beer
2022-09-15  5:44         ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).