On Fri, Sep 15, 2023 at 03:57:43PM +0300, Dan Carpenter wrote:
> Hello Kent Overstreet,
> 
> The patch b3dc2344548f: "bcachefs: reserve space in journal for fs
> usage entries" from Jan 24, 2019 (linux-next), leads to the following
> Smatch static checker warning:
> 
>       fs/bcachefs/journal_io.c:468 journal_entry_blacklist_v2_validate()
>       warn: missing error code here? 'journal_entry_err_on()' failed. 'ret' = 
> '0'
> 
> fs/bcachefs/journal_io.c
>     455 static int journal_entry_blacklist_v2_validate(struct bch_fs *c,
>     456                                 struct jset *jset,
>     457                                 struct jset_entry *entry,
>     458                                 unsigned version, int big_endian,
>     459                                 enum bkey_invalid_flags flags)
>     460 {
>     461         struct jset_entry_blacklist_v2 *bl_entry;
>     462         int ret = 0;
>     463 
>     464         if (journal_entry_err_on(le16_to_cpu(entry->u64s) != 2,
>     465                                  c, version, jset, entry,
>     466                 "invalid journal seq blacklist entry: bad size")) {
>     467                 journal_entry_null_range(entry, vstruct_next(entry));
> --> 468                 goto out;
> 
> Should these error
> 
>     469         }
>     470 
>     471         bl_entry = container_of(entry, struct 
> jset_entry_blacklist_v2, entry);
>     472 
>     473         if (journal_entry_err_on(le64_to_cpu(bl_entry->start) >
>     474                                  le64_to_cpu(bl_entry->end),
>     475                                  c, version, jset, entry,
>     476                 "invalid journal seq blacklist entry: start > end")) {
>     477                 journal_entry_null_range(entry, vstruct_next(entry));
> 
> paths set an error code?

No. When we detect a fsck error, there are three possible ways we might
continue:
 - we might continue without fixing the error
 - we might abort, and return an error
 - we might fix the error

fsck_err_on(), journal_entry_err_on(), etc. return true if we wish to
fix the error, they call "goto fsck_err" if we want to abort with an
error code.

Reply via email to