Thread (8 messages) 8 messages, 2 authors, 2022-05-12
STALE1496d

[PATCH v2 3/6] lib/support: check whether inump is null before, accessing it in quota_set_sb_inum()

From: zhanchengbin <hidden>
Date: 2021-12-31 07:42:20
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

In quota_set_sb_inum(), we should check whether inump is null before 
accessing it,
otherwise the null potinter dereference error may occur.

Signed-off-by: zhanchengbin <redacted>
---
  lib/support/mkquota.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index 6f4a0b90..482e3d91 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -99,7 +99,8 @@ void quota_set_sb_inum(ext2_filsys fs, ext2_ino_t ino, 
enum quota_type qtype)

  	log_debug("setting quota ino in superblock: ino=%u, type=%d", ino,
  		 qtype);
-	*inump = ino;
+	if (inump != NULL)
+		*inump = ino;
  	ext2fs_mark_super_dirty(fs);
  }

-- 
2.27.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help