Patch "jffs2: fix use of uninitialized variable" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    jffs2: fix use of uninitialized variable

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     jffs2-fix-use-of-uninitialized-variable.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 17d1c0740ed4aac180b407d506a9684ebb6b032b
Author: Qingfang Deng <qingfang.deng@xxxxxxxxxxxxxxx>
Date:   Mon Jul 1 12:52:05 2024 +0800

    jffs2: fix use of uninitialized variable
    
    [ Upstream commit 3ba44ee966bc3c41dd8a944f963466c8fcc60dc8 ]
    
    When building the kernel with -Wmaybe-uninitialized, the compiler
    reports this warning:
    
    In function 'jffs2_mark_erased_block',
        inlined from 'jffs2_erase_pending_blocks' at fs/jffs2/erase.c:116:4:
    fs/jffs2/erase.c:474:9: warning: 'bad_offset' may be used uninitialized [-Wmaybe-uninitialized]
      474 |         jffs2_erase_failed(c, jeb, bad_offset);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fs/jffs2/erase.c: In function 'jffs2_erase_pending_blocks':
    fs/jffs2/erase.c:402:18: note: 'bad_offset' was declared here
      402 |         uint32_t bad_offset;
          |                  ^~~~~~~~~~
    
    When mtd->point() is used, jffs2_erase_pending_blocks can return -EIO
    without initializing bad_offset, which is later used at the filebad
    label in jffs2_mark_erased_block.
    Fix it by initializing this variable.
    
    Fixes: 8a0f572397ca ("[JFFS2] Return values of jffs2_block_check_erase error paths")
    Signed-off-by: Qingfang Deng <qingfang.deng@xxxxxxxxxxxxxxx>
    Reviewed-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>
    Signed-off-by: Richard Weinberger <richard@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c
index 7e9abdb897122..5fbaf6ab9f482 100644
--- a/fs/jffs2/erase.c
+++ b/fs/jffs2/erase.c
@@ -340,10 +340,9 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
 		} while(--retlen);
 		mtd_unpoint(c->mtd, jeb->offset, c->sector_size);
 		if (retlen) {
-			pr_warn("Newly-erased block contained word 0x%lx at offset 0x%08tx\n",
-				*wordebuf,
-				jeb->offset +
-				c->sector_size-retlen * sizeof(*wordebuf));
+			*bad_offset = jeb->offset + c->sector_size - retlen * sizeof(*wordebuf);
+			pr_warn("Newly-erased block contained word 0x%lx at offset 0x%08x\n",
+				*wordebuf, *bad_offset);
 			return -EIO;
 		}
 		return 0;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux