Skip to content

Commit b98e26d

Browse files
committed
cifs: fix signed/unsigned mismatch on aio_read patch
The patch "CIFS: Add support for direct I/O read" had a signed/unsigned mismatch (ssize_t vs. size_t) in the return from one function. Similar trivial change in aio_write Signed-off-by: Long Li <longli@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
1 parent 8c6c9be commit b98e26d

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎fs/cifs/file.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,18 +2625,21 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
26252625
break;
26262626

26272627
if (ctx->direct_io) {
2628-
cur_len = iov_iter_get_pages_alloc(
2628+
ssize_t result;
2629+
2630+
result = iov_iter_get_pages_alloc(
26292631
from, &pagevec, wsize, &start);
2630-
if (cur_len < 0) {
2632+
if (result < 0) {
26312633
cifs_dbg(VFS,
26322634
"direct_writev couldn't get user pages "
26332635
"(rc=%zd) iter type %d iov_offset %zd "
26342636
"count %zd\n",
2635-
cur_len, from->type,
2637+
result, from->type,
26362638
from->iov_offset, from->count);
26372639
dump_stack();
26382640
break;
26392641
}
2642+
cur_len = (size_t)result;
26402643
iov_iter_advance(from, cur_len);
26412644

26422645
nr_pages =
@@ -3322,21 +3325,23 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file,
33223325
cur_len = min_t(const size_t, len, rsize);
33233326

33243327
if (ctx->direct_io) {
3328+
ssize_t result;
33253329

3326-
cur_len = iov_iter_get_pages_alloc(
3330+
result = iov_iter_get_pages_alloc(
33273331
&direct_iov, &pagevec,
33283332
cur_len, &start);
3329-
if (cur_len < 0) {
3333+
if (result < 0) {
33303334
cifs_dbg(VFS,
33313335
"couldn't get user pages (cur_len=%zd)"
33323336
" iter type %d"
33333337
" iov_offset %zd count %zd\n",
3334-
cur_len, direct_iov.type,
3338+
result, direct_iov.type,
33353339
direct_iov.iov_offset,
33363340
direct_iov.count);
33373341
dump_stack();
33383342
break;
33393343
}
3344+
cur_len = (size_t)result;
33403345
iov_iter_advance(&direct_iov, cur_len);
33413346

33423347
rdata = cifs_readdata_direct_alloc(

0 commit comments

Comments
 (0)