
From: Dan Carpenter <dan.carpenter@oracle.com> mainline inclusion from mainline-5.15-rc1 commit 8ef32967065737dac51974efae333436354bea0a category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I60T7G CVE: NA Reference: https://git.kernel.org/torvalds/linux/c/8ef329670657 ------------------------------- The smb_direct_alloc_sendmsg() function never returns NULL, it only returns error pointers so the check needs to be updated. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Jason Yan <yanaijie@huawei.com> Signed-off-by: Zhong Jinghua <zhongjinghua@huawei.com> --- fs/cifsd/transport_rdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifsd/transport_rdma.c b/fs/cifsd/transport_rdma.c index 4f4806d67ab0..d235051dc5b1 100644 --- a/fs/cifsd/transport_rdma.c +++ b/fs/cifsd/transport_rdma.c @@ -997,8 +997,8 @@ static int smb_direct_create_header(struct smb_direct_transport *t, int ret; sendmsg = smb_direct_alloc_sendmsg(t); - if (!sendmsg) - return -ENOMEM; + if (IS_ERR(sendmsg)) + return PTR_ERR(sendmsg); /* Fill in the packet header */ packet = (struct smb_direct_data_transfer *)sendmsg->packet; -- 2.31.1