Skip to content

Commit e946d3c

Browse files
Dan Carpentersmfrench
authored andcommitted
cifs: fix a sign extension bug
The problem is the mismatched types between "ctx->total_len" which is an unsigned int, "rc" which is an int, and "ctx->rc" which is a ssize_t. The code does: ctx->rc = (rc == 0) ? ctx->total_len : rc; We want "ctx->rc" to store the negative "rc" error code. But what happens is that "rc" is type promoted to a high unsigned int and 'ctx->rc" will store the high positive value instead of a negative value. The fix is to change "rc" from an int to a ssize_t. Fixes: c610c4b ("CIFS: Add asynchronous write support through kernel AIO") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent fdf5078 commit e946d3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/cifs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,7 @@ static void collect_uncached_write_data(struct cifs_aio_ctx *ctx)
31133113
struct cifs_tcon *tcon;
31143114
struct cifs_sb_info *cifs_sb;
31153115
struct dentry *dentry = ctx->cfile->dentry;
3116-
int rc;
3116+
ssize_t rc;
31173117

31183118
tcon = tlink_tcon(ctx->cfile->tlink);
31193119
cifs_sb = CIFS_SB(dentry->d_sb);

0 commit comments

Comments
 (0)