Hi Dan, > On 20 May 2017 at 11:49 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > > "prev_bh" is a valid pointer. "bh" is an error pointer. "written" is > either an error pointer, or a the number of bytes we have written. If > we haven't written any bytes then we want to return the error code > stored in "bh". So we need to that before resetting "bh" to a valid > pointer. > > This bug is older than git. > > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Acked-by: Fabian Frederick <fabf@xxxxxxxxx> > > diff --git a/fs/affs/file.c b/fs/affs/file.c > index 196ee7f6fdc4..99610050199c 100644 > --- a/fs/affs/file.c > +++ b/fs/affs/file.c > @@ -800,9 +800,9 @@ static int affs_write_end_ofs(struct file *file, struct > address_space *mapping, > return written; > > err_bh: > - bh = prev_bh; > if (!written) > written = PTR_ERR(bh); > + bh = prev_bh; > goto done; > } >