From: piaojun <piaojun@huawei.com>
To: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
<ericvh@gmail.com>, <rminnich@sandia.gov>, <lucho@ionkov.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
<v9fs-developer@lists.sourceforge.net>,
Jiangyiwen <jiangyiwen@huawei.com>
Subject: [PATCH] 9p/net/protocol.c: return -ENOMEM when kmalloc() failed
Date: Wed, 11 Jul 2018 08:43:49 +0800 [thread overview]
Message-ID: <5B4552C5.60000@huawei.com> (raw)
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)) {
--
next reply other threads:[~2018-07-11 0:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 0:43 piaojun [this message]
2018-07-11 1:25 ` [PATCH] 9p/net/protocol.c: return -ENOMEM when kmalloc() failed jiangyiwen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5B4552C5.60000@huawei.com \
--to=piaojun@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=ericvh@gmail.com \
--cc=jiangyiwen@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=rminnich@sandia.gov \
--cc=v9fs-developer@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).