* [bug report] bcachefs: missing error codes in journal_entry_blacklist_v2_validate()
@ 2023-09-15 12:57 Dan Carpenter
2023-09-20 1:50 ` Kent Overstreet
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2023-09-15 12:57 UTC (permalink / raw)
To: kent.overstreet; +Cc: linux-bcachefs
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?
478 }
479 out:
480 fsck_err:
481 return ret;
482 }
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] bcachefs: missing error codes in journal_entry_blacklist_v2_validate()
2023-09-15 12:57 [bug report] bcachefs: missing error codes in journal_entry_blacklist_v2_validate() Dan Carpenter
@ 2023-09-20 1:50 ` Kent Overstreet
0 siblings, 0 replies; 2+ messages in thread
From: Kent Overstreet @ 2023-09-20 1:50 UTC (permalink / raw)
To: Dan Carpenter; +Cc: kent.overstreet, linux-bcachefs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-20 1:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 12:57 [bug report] bcachefs: missing error codes in journal_entry_blacklist_v2_validate() Dan Carpenter
2023-09-20 1:50 ` Kent Overstreet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.