Skip to contentSkip to conversation

dax-initialize-variable-pfn-before-using-it.patch removed from -mm tree

merged [email protected] 1 participant 1 message Sep 7, 2017

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: dax: initialize variable pfn before using it
has been removed from the -mm tree. Its filename was
dax-initialize-variable-pfn-before-using-it.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Nicolas Iooss <[email protected]>
Subject: dax: initialize variable pfn before using it

dax_pmd_insert_mapping() contains the following code:

        pfn_t pfn;
        if (bdev_dax_pgoff(bdev, sector, size, &pgoff) != 0)
            goto fallback;
        /* ... */
    fallback:
      trace_dax_pmd_insert_mapping_fallback(inode, vmf, length, pfn, ret);

When the condition in the if statement fails, the function calls trace_dax_pmd_insert_mapping_fallback() with an uninitialized pfn value.

This issue has been found while building the kernel with clang. The compiler reported:

    fs/dax.c:1280:6: error: variable 'pfn' is used uninitialized
    whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (bdev_dax_pgoff(bdev, sector, size, &pgoff) != 0)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fs/dax.c:1310:60: note: uninitialized use occurs here
      trace_dax_pmd_insert_mapping_fallback(inode, vmf, length, pfn, ret);
                                                                     ^~~

---

 fs/dax.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/dax.c renamed from fs/dax.c~dax-initialize-variable-pfn-before-using-it +1 -1
diff -puN fs/dax.c~dax-initialize-variable-pfn-before-using-it fs/dax.c
@@ -1230,7 +1230,7 @@ static int dax_pmd_insert_mapping(struct
 	void *ret = NULL, *kaddr;
 	long length = 0;
 	pgoff_t pgoff;
-	pfn_t pfn;
+	pfn_t pfn = {};
 	int id;
 
 	if (bdev_dax_pgoff(bdev, sector, size, &pgoff) != 0)

_

Patches currently in -mm which might be from [email protected] are