mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/mm/kmmio: return -ENOMEM when kzalloc failed
@ 2023-07-27  7:42 Jiapeng Chong
  0 siblings, 0 replies; only message in thread
From: Jiapeng Chong @ 2023-07-27  7:42 UTC (permalink / raw)
  To: rostedt
  Cc: mhiramat, karolherbst, ppaalanen, dave.hansen, luto, peterz,
	tglx, mingo, bp, x86, hpa, linux-kernel, nouveau, Jiapeng Chong,
	Abaci Robot

The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed.

arch/x86/mm/kmmio.c:392 add_kmmio_fault_page() warn: returning -1 instead of -ENOMEM is sloppy.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6002
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 arch/x86/mm/kmmio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index 9f82019179e1..9aa5bcf5a836 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -389,14 +389,14 @@ static int add_kmmio_fault_page(unsigned long addr)
 
 	f = kzalloc(sizeof(*f), GFP_ATOMIC);
 	if (!f)
-		return -1;
+		return -ENOMEM;
 
 	f->count = 1;
 	f->addr = addr;
 
 	if (arm_kmmio_fault_page(f)) {
 		kfree(f);
-		return -1;
+		return -ENOMEM;
 	}
 
 	list_add_rcu(&f->list, kmmio_page_list(f->addr));
-- 
2.20.1.7.g153144c


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-27  7:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27  7:42 [PATCH] x86/mm/kmmio: return -ENOMEM when kzalloc failed Jiapeng Chong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®