]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
afs: Fix the maths in afs_fs_store_data()
authorDavid Howells <dhowells@redhat.com>
Thu, 16 Mar 2017 16:27:47 +0000 (16:27 +0000)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 17 Jan 2018 17:55:35 +0000 (12:55 -0500)
commit6057493b8d401c2586479fe1e19accb883398feb
tree61c81000344d44ec2160e4c87582259ed70c624b
parent6002fff6d220c112935fa96a2d796528b71aac05
afs: Fix the maths in afs_fs_store_data()

[ Upstream commit 146a1192783697810b63a1e41c4d59fc93387340 ]

afs_fs_store_data() works out of the size of the write it's going to make,
but it uses 32-bit unsigned subtraction in one place that gets
automatically cast to loff_t.

However, if to < offset, then the number goes negative, but as the result
isn't signed, this doesn't get sign-extended to 64-bits when placed in a
loff_t.

Fix by casting the operands to loff_t.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
fs/afs/fsclient.c