[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <k53h44tbytos5tvvbg263qpbkl4xzjcsj35fmpzxxie7dn7z65@ombf4w6za4ui>
Date: Wed, 20 Aug 2025 16:03:44 -0100
From: Andi Shyti <andi.shyti@...nel.org>
To: Rodrigo Vivi <rodrigo.vivi@...el.com>
Cc: 陈涛涛 Taotao Chen <chentaotao@...iglobal.com>,
"jani.nikula@...ux.intel.com" <jani.nikula@...ux.intel.com>,
"joonas.lahtinen@...ux.intel.com" <joonas.lahtinen@...ux.intel.com>, "tursulin@...ulin.net" <tursulin@...ulin.net>,
"airlied@...il.com" <airlied@...il.com>, "simona@...ll.ch" <simona@...ll.ch>,
"oe-lkp@...ts.linux.dev" <oe-lkp@...ts.linux.dev>, "lkp@...el.com" <lkp@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"intel-gfx@...ts.freedesktop.org" <intel-gfx@...ts.freedesktop.org>, "brauner@...nel.org" <brauner@...nel.org>,
"oliver.sang@...el.com" <oliver.sang@...el.com>
Subject: Re: [PATCH 2/2] drm/i915: Fix incorrect error handling in
shmem_pwrite()
Hi Rodrigo,
...
> > @@ -441,12 +441,12 @@ shmem_pwrite(struct drm_i915_gem_object *obj,
> > written = file->f_op->write_iter(&kiocb, &iter);
> > BUG_ON(written == -EIOCBQUEUED);
> >
> > - if (written != size)
> > - return -EIO;
> > -
> > if (written < 0)
> > return written;
> >
> > + if (written != size)
> > + return -EIO;
>
> That's awkward...
>
> I mean, you are right that we cannot overwrite what is returned from the
> write_iter function. But perhaps this != check here should be before?
>
> Or it at least deserves a comment in the code telling what's the intent
> here. why != size is -EIO... but it was already written :/
The check (written < 0) is completely useless after (written !=
size), so that I think the patch is correct.
Andi
> > +
> > return 0;
> > }
> >
> > --
> > 2.34.1
Powered by blists - more mailing lists