* [PATCH] 9p/net/protocol.c: return -ENOMEM when kmalloc() failed
@ 2018-07-11 0:43 piaojun
2018-07-11 1:25 ` jiangyiwen
0 siblings, 1 reply; 2+ messages in thread
From: piaojun @ 2018-07-11 0:43 UTC (permalink / raw)
To: akpm, ericvh, rminnich, lucho
Cc: Linux Kernel Mailing List, v9fs-developer, Jiangyiwen
We should return -ENOMEM to upper user when kmalloc failed to indicate
accurate errno.
Signed-off-by: Jun Piao <piaojun@huawei.com>
---
net/9p/protocol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 931ea00..4a1e1dd 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -156,7 +156,7 @@ static size_t pdu_write(struct p9_fcall *pdu, const void *data, size_t size)
*sptr = kmalloc(len + 1, GFP_NOFS);
if (*sptr == NULL) {
- errcode = -EFAULT;
+ errcode = -ENOMEM;
break;
}
if (pdu_read(pdu, *sptr, len)) {
--
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] 9p/net/protocol.c: return -ENOMEM when kmalloc() failed
2018-07-11 0:43 [PATCH] 9p/net/protocol.c: return -ENOMEM when kmalloc() failed piaojun
@ 2018-07-11 1:25 ` jiangyiwen
0 siblings, 0 replies; 2+ messages in thread
From: jiangyiwen @ 2018-07-11 1:25 UTC (permalink / raw)
To: piaojun, akpm, ericvh, rminnich, lucho
Cc: Linux Kernel Mailing List, v9fs-developer
On 2018/7/11 8:43, piaojun wrote:
> We should return -ENOMEM to upper user when kmalloc failed to indicate
> accurate errno.
>
> Signed-off-by: Jun Piao <piaojun@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
> ---
> net/9p/protocol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/9p/protocol.c b/net/9p/protocol.c
> index 931ea00..4a1e1dd 100644
> --- a/net/9p/protocol.c
> +++ b/net/9p/protocol.c
> @@ -156,7 +156,7 @@ static size_t pdu_write(struct p9_fcall *pdu, const void *data, size_t size)
>
> *sptr = kmalloc(len + 1, GFP_NOFS);
> if (*sptr == NULL) {
> - errcode = -EFAULT;
> + errcode = -ENOMEM;
> break;
> }
> if (pdu_read(pdu, *sptr, len)) {
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-11 1:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 0:43 [PATCH] 9p/net/protocol.c: return -ENOMEM when kmalloc() failed piaojun
2018-07-11 1:25 ` jiangyiwen
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).