Skip to content

Commit 4e3edd0

Browse files
hcleesmfrench
authored andcommitted
ksmbd: smbd: change the return value of get_sg_list
Make get_sg_list return EINVAL if there aren't mapped scatterlists. Signed-off-by: Hyunchul Lee <[email protected]> Acked-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 11659a8 commit 4e3edd0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ksmbd/transport_rdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ static int get_sg_list(void *buf, int size, struct scatterlist *sg_list, int nen
10791079
int offset, len;
10801080
int i = 0;
10811081

1082-
if (nentries < get_buf_page_count(buf, size))
1082+
if (size <= 0 || nentries < get_buf_page_count(buf, size))
10831083
return -EINVAL;
10841084

10851085
offset = offset_in_page(buf);
@@ -1111,7 +1111,7 @@ static int get_mapped_sg_list(struct ib_device *device, void *buf, int size,
11111111
int npages;
11121112

11131113
npages = get_sg_list(buf, size, sg_list, nentries);
1114-
if (npages <= 0)
1114+
if (npages < 0)
11151115
return -EINVAL;
11161116
return ib_dma_map_sg(device, sg_list, npages, dir);
11171117
}

0 commit comments

Comments
 (0)