Skip to content

Commit 6eed261

Browse files
committed
pstore/blk: Improve failure reporting
There was no feedback on bad registration attempts. Add details on the failure cause. Cc: Anton Vorontsov <[email protected]> Cc: Colin Cross <[email protected]> Cc: Tony Luck <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent d07f6ca commit 6eed261

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

fs/pstore/blk.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,22 @@ static int __register_pstore_device(struct pstore_device_info *dev)
114114

115115
lockdep_assert_held(&pstore_blk_lock);
116116

117-
if (!dev || !dev->total_size || !dev->read || !dev->write)
117+
if (!dev) {
118+
pr_err("NULL device info\n");
118119
return -EINVAL;
120+
}
121+
if (!dev->total_size) {
122+
pr_err("zero sized device\n");
123+
return -EINVAL;
124+
}
125+
if (!dev->read) {
126+
pr_err("no read handler for device\n");
127+
return -EINVAL;
128+
}
129+
if (!dev->write) {
130+
pr_err("no write handler for device\n");
131+
return -EINVAL;
132+
}
119133

120134
/* someone already registered before */
121135
if (pstore_zone_info)

0 commit comments

Comments
 (0)