On Fri, Oct 17, 2025 at 12:58:39PM -0400, Sean Anderson wrote:
> On 10/2/25 05:39, Andrew Goodbody wrote:
> > After calling a function that can return an error, the test to detect
> > that error should use the return value not a different variable. Fix it.
> > 
> > This issue was found by Smatch.
> > 
> > Signed-off-by: Andrew Goodbody <[email protected]>
> > ---
> >  fs/semihostingfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/semihostingfs.c b/fs/semihostingfs.c
> > index 
> > 77e39ca407e4d240a1fd573497c5b6b908816454..9d7a136b9ba9b035545b34b31df58e2d65de7db9
> >  100644
> > --- a/fs/semihostingfs.c
> > +++ b/fs/semihostingfs.c
> > @@ -35,7 +35,7 @@ static int smh_fs_read_at(const char *filename, loff_t 
> > pos, void *buffer,
> >     }
> >     if (!maxsize) {
> >             size = smh_flen(fd);
> > -           if (ret < 0) {
> > +           if (size < 0) {
> >                     smh_close(fd);
> >                     return size;
> >             }
> > 
> > ---
> > base-commit: da47ddebd16a7e1047da8537fbf01558d2a89fcf
> > change-id: 20251002-fs_semihosting-85d697fbfcad
> > 
> > Best regards,
> 
> Reviewed-by: Sean Anderson <[email protected]>

I am inclined to say that step one here is this patch, and step two is
figuring out what if anything can / should be done for the problematic
case where it seems that other implementations of this do not follow the
spec, or the spec is too ambiguous.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to