Re: [PATCH v7 08/24] erofs: add namei functions

From: Pavel Machek
Date: Tue Aug 13 2019 - 07:48:26 EST


Hi!

> + /*
> + * on-disk error, let's only BUG_ON in the debugging mode.
> + * otherwise, it will return 1 to just skip the invalid name
> + * and go on (in consideration of the lookup performance).
> + */
> + DBG_BUGON(qd->name > qd->end);

I believe you should check for errors in non-debug mode, too.


> + if (unlikely(!ndirents)) {
> + DBG_BUGON(1);
> + kunmap_atomic(de);
> + put_page(page);
> + page = ERR_PTR(-EIO);
> + goto out;
> + }

-EUCLEAN is right error code for corrupted filesystem. (And you
probably want to print something to the syslog, too).

Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: Digital signature