Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1617907 > unrolled thread
| Started by | Dmitry Monakhov <dmonakhov@openvz.org> |
|---|---|
| First post | 2017-04-06 14:10 +0200 |
| Last post | 2017-04-06 14:10 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/5] block: protect bdevname from null pointer bdev Dmitry Monakhov <dmonakhov@openvz.org> - 2017-04-06 14:10 +0200
| From | Dmitry Monakhov <dmonakhov@openvz.org> |
|---|---|
| Date | 2017-04-06 14:10 +0200 |
| Subject | [PATCH 2/5] block: protect bdevname from null pointer bdev |
| Message-ID | <tteoF-8jD-15@gated-at.bofh.it> |
Some callers (usually error paths) call bdevname with null bdev.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
block/partition-generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 7afb990..284de18 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -46,6 +46,8 @@ char *disk_name(struct gendisk *hd, int partno, char *buf)
const char *bdevname(struct block_device *bdev, char *buf)
{
+ if (unlikely(!bdev))
+ return snprintf(buf, BDEVNAME_SIZE, "unknown-block(null)");
return disk_name(bdev->bd_disk, bdev->bd_part->partno, buf);
}
--
2.9.3
Back to top | Article view | linux.kernel
csiph-web