ocfs2: use kzalloc for quota recovery bitmap allocation
PATCH 1/1 ocfs2: use kzalloc for quota recovery bitmap allocation
From: Tristan Madani <[email protected]>
ocfs2 quota recovery allocates a bitmap buffer with kmalloc and does not fully initialize it. This can lead to use of uninitialized bits during quota recovery from a corrupted filesystem image.
Use kzalloc instead to ensure the bitmap is zero-initialized.
--- fs/ocfs2/quota_local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/quota_local.c +1 -1
@@ -302,7 +302,7 @@ static int ocfs2_add_recovery_chunk(struct super_block *sb,if (!rc)return -ENOMEM ; rc->rc_chunk = chunk; - rc->rc_bitmap =kmalloc (sb->s_blocksize,GFP_NOFS ); + rc->rc_bitmap =kzalloc (sb->s_blocksize,GFP_NOFS );if (!rc->rc_bitmap) {kfree (rc);return -ENOMEM ;
Signature · 1 line
2.47.3
Quoted 11 lines · Tristan Madani
From: Tristan Madani <[email protected]>
ocfs2 quota recovery allocates a bitmap buffer with kmalloc and does not fully initialize it. This can lead to use of uninitialized bits during quota recovery from a corrupted filesystem image.
Use kzalloc instead to ensure the bitmap is zero-initialized.
Looks good.
Quoted 17 lines
--- fs/ocfs2/quota_local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/ocfs2/quota_local.c +1
-1@@ -302,7 +302,7 @@ static int ocfs2_add_recovery_chunk(struct super_block *sb,if (!rc)return -ENOMEM ; rc->rc_chunk = chunk; - rc->rc_bitmap =kmalloc (sb->s_blocksize,GFP_NOFS ); + rc->rc_bitmap =kzalloc (sb->s_blocksize,GFP_NOFS );if (!rc->rc_bitmap) {kfree (rc);return -ENOMEM ;
Quoted 5 lines · On Sat, 18 Apr 2026 13:10:48 +0000 Tristan Madani <[email protected]> wrote:
ocfs2 quota recovery allocates a bitmap buffer with kmalloc and does not fully initialize it. This can lead to use of uninitialized bits during quota recovery from a corrupted filesystem image.
Use kzalloc instead to ensure the bitmap is zero-initialized.
AI review asks a question about the nearby code:
https://sashiko.dev/#/patchset/[email protected]