Skip to contentSkip to conversation

x86/mm/kmmio: correctly handle kzalloc return

PATCH In review Mugilraj Dhavachelvan 2 participants 2 messages Oct 20, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm/kmmio: correctly handle kzalloc return

Replacing return value -1 to error code

---
 arch/x86/mm/kmmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kmmio.c +1 -1
index be020a7bc414..15430520c232 100644
@@ -386,7 +386,7 @@ static int add_kmmio_fault_page(unsigned long addr)
 
 	f = kzalloc(sizeof(*f), GFP_ATOMIC);
 	if (!f)
-		return -1;
+		return -ENOMEN;
 
 	f->count = 1;
 	f->addr = addr;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 12 lines · On Tue, 20 Oct 2020 14:13:44 +0530 Mugilraj Dhavachelvan…

Replacing return value -1 to error code

---
 arch/x86/mm/kmmio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/mm/kmmio.c +0 -0
index be020a7bc414..15430520c232 100644

arch/x86/mm/kmmio.c static int add_kmmio_fault_page(unsigned long addr) · line 392

Quoted 8 lines
arch/x86/mm/kmmio.c +1 -1
@@ -386,7 +386,7 @@ static int add_kmmio_fault_page(unsigned long addr)
 
 	f = kzalloc(sizeof(*f), GFP_ATOMIC);
 	if (!f)
-		return -1;
+		return -ENOMEN;
 
 	f->count = 1;
 	f->addr = addr;

Hi,

did you even build-test this?

Why did you write this patch? What does it achieve?

Thanks,
pq