Skip to content

Commit b4c458b

Browse files
csabahenkMiklos Szeredi
authored andcommitted
fuse: fix return value of fuse_dev_write()
On 64 bit systems -- where sizeof(ssize_t) > sizeof(int) -- the following test exposes a bug due to a non-careful return of an int or unsigned value: implement a FUSE filesystem which sends an unsolicited notification to the kernel with invalid opcode. The respective write to /dev/fuse will return (1 << 32) - EINVAL with errno == 0 instead of -1 with errno == EINVAL. Signed-off-by: Miklos Szeredi <[email protected]> CC: [email protected]
1 parent 28d0325 commit b4c458b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fuse/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
910910
unsigned long nr_segs, loff_t pos)
911911
{
912912
int err;
913-
unsigned nbytes = iov_length(iov, nr_segs);
913+
size_t nbytes = iov_length(iov, nr_segs);
914914
struct fuse_req *req;
915915
struct fuse_out_header oh;
916916
struct fuse_copy_state cs;

0 commit comments

Comments
 (0)