* [PATCH] CAPI: return -ENOMEM when kmalloc failed
@ 2024-03-14 2:01 Jiapeng Chong
2024-03-14 3:17 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2024-03-14 2:01 UTC (permalink / raw)
To: isdn; +Cc: ricardo, netdev, linux-kernel, Jiapeng Chong, Abaci Robot
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed.
drivers/isdn/capi/capi.c:154 capiminor_add_ack() 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=8522
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
drivers/isdn/capi/capi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 3ed257334562..b6764313fbdb 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -151,7 +151,7 @@ static int capiminor_add_ack(struct capiminor *mp, u16 datahandle)
n = kmalloc(sizeof(*n), GFP_ATOMIC);
if (unlikely(!n)) {
printk(KERN_ERR "capi: alloc datahandle failed\n");
- return -1;
+ return -ENOMEM;
}
n->datahandle = datahandle;
INIT_LIST_HEAD(&n->list);
--
2.20.1.7.g153144c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] CAPI: return -ENOMEM when kmalloc failed
2024-03-14 2:01 [PATCH] CAPI: return -ENOMEM when kmalloc failed Jiapeng Chong
@ 2024-03-14 3:17 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2024-03-14 3:17 UTC (permalink / raw)
To: Jiapeng Chong; +Cc: isdn, ricardo, netdev, linux-kernel, Abaci Robot
On Thu, Mar 14, 2024 at 10:01:03AM +0800, Jiapeng Chong wrote:
> The driver is using -1 instead of the -ENOMEM defined macro to specify
> that a buffer allocation failed.
>
> drivers/isdn/capi/capi.c:154 capiminor_add_ack() 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=8522
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
The patch itself looks reasonable. The caller only cares about is the
return code negative or not. So returning -ENOMEM or -1 makes no
difference.
Please take a look at:
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
You need to specify a tree you want this merged via.
If you consider this a fix, you need to add a Fixes: tag. However, i
don't see this patch meeting stable requirements.
If this is just normal development, net-next is closed at the moment
for the merge window. Please repost in two weeks time.
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-14 3:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 2:01 [PATCH] CAPI: return -ENOMEM when kmalloc failed Jiapeng Chong
2024-03-14 3:17 ` Andrew Lunn
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®