Skip to content

Commit

Permalink
pstore/blk: Improve failure reporting
Browse files Browse the repository at this point in the history
There was no feedback on bad registration attempts. Add details on the
failure cause.

Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Kees Cook committed Jun 16, 2021
1 parent d07f6ca commit 6eed261
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion fs/pstore/blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,22 @@ static int __register_pstore_device(struct pstore_device_info *dev)

lockdep_assert_held(&pstore_blk_lock);

if (!dev || !dev->total_size || !dev->read || !dev->write)
if (!dev) {
pr_err("NULL device info\n");
return -EINVAL;
}
if (!dev->total_size) {
pr_err("zero sized device\n");
return -EINVAL;
}
if (!dev->read) {
pr_err("no read handler for device\n");
return -EINVAL;
}
if (!dev->write) {
pr_err("no write handler for device\n");
return -EINVAL;
}

/* someone already registered before */
if (pstore_zone_info)
Expand Down

0 comments on commit 6eed261

Please sign in to comment.