summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_loopdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmount/src/context_loopdev.c')
-rw-r--r--libmount/src/context_loopdev.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libmount/src/context_loopdev.c b/libmount/src/context_loopdev.c
index fc8da9fe7..369f81dc0 100644
--- a/libmount/src/context_loopdev.c
+++ b/libmount/src/context_loopdev.c
@@ -75,7 +75,8 @@ int mnt_context_is_loopdev(struct libmnt_context *cxt)
/* Check, if there already exists a mounted loop device on the mountpoint node
* with the same parameters.
*/
-static int is_mounted_same_loopfile(struct libmnt_context *cxt,
+static int __attribute__((nonnull))
+is_mounted_same_loopfile(struct libmnt_context *cxt,
const char *target,
const char *backing_file,
uint64_t offset)
@@ -142,10 +143,12 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
int rc = 0, lo_flags = 0;
uint64_t offset = 0, sizelimit = 0;
- assert(cxt);
assert(cxt->fs);
assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));
+ if (!cxt)
+ return -EINVAL;
+
backing_file = mnt_fs_get_srcpath(cxt->fs);
if (!backing_file)
return -EINVAL;
@@ -315,6 +318,9 @@ int mnt_context_delete_loopdev(struct libmnt_context *cxt)
assert(cxt);
assert(cxt->fs);
+ if (!cxt)
+ return -EINVAL;
+
src = mnt_fs_get_srcpath(cxt->fs);
if (!src)
return -EINVAL;
@@ -338,6 +344,9 @@ int mnt_context_clear_loopdev(struct libmnt_context *cxt)
{
assert(cxt);
+ if (!cxt)
+ return -EINVAL;
+
if (mnt_context_get_status(cxt) == 0 &&
(cxt->flags & MNT_FL_LOOPDEV_READY)) {
/*