Skip to contentSkip to conversation

ntfs: add missing error code in ntfs_mft_record_alloc()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ntfs: add missing error code in ntfs_mft_record_alloc()

Return -ENOMEM if the kmalloc() fails. Don't return success.

Fixes 115380f9a2f9 ("ntfs: update mft operations")

---
This email is a free service from the Smatch-CI project [smatch.sf.net].

I have wanted to avoid sending patches but it was easier to fix it than explain the warning. :P

fs/ntfs/namei.c:677 __ntfs_create() error: uninitialized symbol 'ni_mrec'.

 fs/ntfs/mft.c | 1 +
 1 file changed, 1 insertion(+)
fs/ntfs/mft.c +1 -0
index bf028c1aea26..0c545fd08b66 100644
@@ -2503,6 +2503,7 @@ int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode,
 			folio_unlock(folio);
 			kunmap_local(m);
 			folio_put(folio);
+			err = -ENOMEM;
 			goto undo_mftbmp_alloc;
 		}
 
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

2026년 4월 10일 (금) 오후 3:47, Dan Carpenter <[email protected]>님이 작성:

Quoted 5 lines

Return -ENOMEM if the kmalloc() fails. Don't return success.

Fixes 115380f9a2f9 ("ntfs: update mft operations")

Looks good to me.

Quoted 26 lines

---
This email is a free service from the Smatch-CI project [smatch.sf.net].

I have wanted to avoid sending patches but it was easier to fix it than explain the warning. :P

fs/ntfs/namei.c:677 __ntfs_create() error: uninitialized symbol 'ni_mrec'.

 fs/ntfs/mft.c | 1 +
 1 file changed, 1 insertion(+)
fs/ntfs/mft.c +1 -1
index bf028c1aea26..0c545fd08b66 100644
@@ -2503,6 +2503,7 @@ int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode,
                        folio_unlock(folio);
                        kunmap_local(m);
                        folio_put(folio);
+                       err = -ENOMEM;
                        goto undo_mftbmp_alloc;
                }
 
--

2.53.0

Signature · 2 lines
Thanks,
Hyunchul