powerpc/spufs: Check file offset before calculating write size in fixed-sized files
authorJeremy Kerr <jk@ozlabs.org>
Tue, 3 Mar 2009 19:38:07 +0000 (19:38 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 11 Mar 2009 06:11:32 +0000 (17:11 +1100)
commitd219889b769a56901c9a916187ee0af95e6ff8a6
treef43aa77340d1746c46ecef43dbfcf73dacb85038
parente7eec2fc27d7dbefd5852c36b3fe6229e6302c99
powerpc/spufs: Check file offset before calculating write size in fixed-sized files

Based on an original patch from Roel Kluin <roel.kluin@gmail.com>.

The write size calculated during regs and fpcr writes may currently
go negative. Because size is unsigned, this will wrap, and our
check for EFBIG will fail.

Instead, do the check for EFBIG before subtracting from size.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/cell/spufs/file.c