backend: Ensure ops pointer is valid in backend_init()
If support for e.g. the vpnor backend isn't compiled in then the ops
pointer will be set to NULL. Prevent the NULL dereference by validating
each pointer in turn.
Change-Id: I5a293d173736f192e087762308017bf16eda7f4d
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/backend.h b/backend.h
index fadc94b..2433c91 100644
--- a/backend.h
+++ b/backend.h
@@ -154,7 +154,7 @@
master->block_size_shift = 34;
#endif
- if (!master->ops->init)
+ if (!(master && master->ops && master->ops->init))
return -ENOTSUP;
rc = master->ops->init(master, data);