9p/net/protocol.c: return -ENOMEM when kmalloc() failed

We should return -ENOMEM to upper user when kmalloc failed to indicate
accurate errno.

Link: http://lkml.kernel.org/r/5B4552C5.60000@huawei.com
Signed-off-by: Jun Piao <piaojun@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
This commit is contained in:
piaojun 2018-07-11 08:43:49 +08:00 committed by Dominique Martinet
parent 64ad31f328
commit b87d1d2652

View file

@ -156,7 +156,7 @@ p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt,
*sptr = kmalloc(len + 1, GFP_NOFS);
if (*sptr == NULL) {
errcode = -EFAULT;
errcode = -ENOMEM;
break;
}
if (pdu_read(pdu, *sptr, len)) {