All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 6241/7172] fs/f2fs/f2fs.h:2376:9: warning: use of uninitialized value 'ino' [CWE-457]
@ 2022-09-15  0:55 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-09-15  0:55 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 15243 bytes --]

:::::: 
:::::: Manual check reason: "low confidence bisect report"
:::::: Manual check reason: "low confidence static check first_new_problem: fs/f2fs/f2fs.h:2376:9: warning: use of uninitialized value 'ino' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]"
:::::: 

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Chao Yu <yuchao0@huawei.com>, Chao Yu <chao@kernel.org>
CC: Jaegeuk Kim <jaegeuk@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   f117c01187301a087412bd6697fcf5463cb427d8
commit: 64c11570d64d143fa212c2739bf743e8e8b9095c [6241/7172] f2fs: fix to do sanity check on summary info
:::::: branch date: 18 hours ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20220911 (https://download.01.org/0day-ci/archive/20220915/202209150827.Ldph2OJT-lkp(a)intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=64c11570d64d143fa212c2739bf743e8e8b9095c
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 64c11570d64d143fa212c2739bf743e8e8b9095c
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

gcc_analyzer warnings: (new ones prefixed by >>)
              |      |                    ~
              |      |                    |
              |      |                    (34) following 'false' branch...
              |......
              |  763 |                 if (!is_recoverable_dnode(page)) {
              |      |                    ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                    | |
              |      |                    | (35) ...to here
              |      |                    (36) following 'true' branch...
              |
            'recover_data': event 37
              |
              |include/asm-generic/memory_model.h:19:57:
              |   19 | #define __page_to_pfn(page)     ((unsigned long)((page) - mem_map) + \
              |      |                                                         ^
              |      |                                                         |
              |      |                                                         (37) ...to here
   arch/arm/include/asm/memory.h:328:71: note: in definition of macro '__va'
              |  328 | #define __va(x)                 ((void *)__phys_to_virt((phys_addr_t)(x)))
              |      |                                                                       ^
   include/linux/mm.h:114:30: note: in expansion of macro 'PFN_PHYS'
              |  114 | #define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x)))
              |      |                              ^~~~~~~~
   include/asm-generic/memory_model.h:52:21: note: in expansion of macro '__page_to_pfn'
              |   52 | #define page_to_pfn __page_to_pfn
              |      |                     ^~~~~~~~~~~~~
   include/linux/mm.h:114:39: note: in expansion of macro 'page_to_pfn'
              |  114 | #define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x)))
              |      |                                       ^~~~~~~~~~~
   include/linux/mm.h:1682:16: note: in expansion of macro 'page_to_virt'
              | 1682 |         return page_to_virt(page);
              |      |                ^~~~~~~~~~~~
              |
            'recover_data': event 38
              |
              |include/linux/list.h:675:14:
              |  675 |              !list_entry_is_head(pos, head, member);                    \
              |      |              ^
              |      |              |
              |      |              (38) following 'true' branch...
   fs/f2fs/recovery.c:71:9: note: in expansion of macro 'list_for_each_entry'
              |   71 |         list_for_each_entry(entry, head, list)
              |      |         ^~~~~~~~~~~~~~~~~~~
              |
            'recover_data': events 39-40
              |
              |   72 |                 if (entry->inode->i_ino == ino)
              |      |                     ~~~~~^~~~~~~
              |      |                          |
              |      |                          (39) ...to here
              |......
              |  769 |                 if (!entry)
              |      |                    ~      
              |      |                    |
              |      |                    (40) following 'false' branch...
              |
            'recover_data': event 41
              |
              |fs/f2fs/f2fs.h:2847:37:
              | 2847 | #define RAW_IS_INODE(p) ((p)->footer.nid == (p)->footer.ino)
              |      |                          ~~~~~~~~~~~^~~~
              |      |                                     |
              |      |                                     (41) ...to here
   fs/f2fs/f2fs.h:2853:16: note: in expansion of macro 'RAW_IS_INODE'
              | 2853 |         return RAW_IS_INODE(p);
              |      |                ^~~~~~~~~~~~
              |
            'recover_data': events 42-46
              |
              |fs/f2fs/recovery.c:776:20:
              |  776 |                 if (IS_INODE(page)) {
              |      |                    ^
              |      |                    |
              |      |                    (42) following 'false' branch...
              |......
              |  783 |                 if (entry->last_dentry == blkaddr) {
              |      |                    ~~~~~~~~~~~~~~~~~~~
              |      |                    |     |
              |      |                    |     (43) ...to here
              |      |                    (44) following 'true' branch...
              |  784 |                         err = recover_dentry(entry->inode, page, dir_list);
              |      |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                               |
              |      |                               (45) ...to here
              |      |                               (46) calling 'recover_dentry' from 'recover_data'
              |
              +--> 'recover_dentry': events 47-48
                     |
                     |  167 | static int recover_dentry(struct inode *inode, struct page *ipage,
                     |      |            ^~~~~~~~~~~~~~
                     |      |            |
                     |      |            (47) entry to 'recover_dentry'
                     |......
                     |  175 |         struct page *page;
                     |      |                      ~~~~
                     |      |                      |
                     |      |                      (48) use of uninitialized value '<unknown>' here
                     |
   In file included from fs/f2fs/recovery.c:12:
   fs/f2fs/recovery.c: In function 'check_index_in_prev_nodes':
>> fs/f2fs/f2fs.h:2376:9: warning: use of uninitialized value 'ino' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]
    2376 |         f2fs_printk(sbi, KERN_ERR fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/recovery.c:508:17: note: in expansion of macro 'f2fs_err'
     508 |                 f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u",
         |                 ^~~~~~~~
     'f2fs_recover_fsync_data': events 1-2
       |
       |  813 | int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
       |      |     ^~~~~~~~~~~~~~~~~~~~~~~
       |      |     |
       |      |     (1) entry to 'f2fs_recover_fsync_data'
       |......
       |  844 |         err = find_fsync_dnodes(sbi, &inode_list, check_only);
       |      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       |      |               |
       |      |               (2) calling 'find_fsync_dnodes' from 'f2fs_recover_fsync_data'
       |
       +--> 'find_fsync_dnodes': event 3
              |
              |  363 | static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head,
              |      |            ^~~~~~~~~~~~~~~~~
              |      |            |
              |      |            (3) entry to 'find_fsync_dnodes'
              |
            'find_fsync_dnodes': event 4
              |
              |fs/f2fs/segment.h:71:46:
              |   71 |         (SM_I(sbi) ? SM_I(sbi)->seg0_blkaddr :                          \
              |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                                              |
              |      |                                              (4) following 'true' branch...
              |   72 |                 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment0_blkaddr))
              |      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.h:86:34: note: in expansion of macro 'SEG0_BLKADDR'
              |   86 | #define START_BLOCK(sbi, segno) (SEG0_BLKADDR(sbi) +                    \
              |      |                                  ^~~~~~~~~~~~
   fs/f2fs/segment.h:90:10: note: in expansion of macro 'START_BLOCK'
              |   90 |         (START_BLOCK(sbi, (curseg)->segno) + (curseg)->next_blkoff)
              |      |          ^~~~~~~~~~~
   fs/f2fs/recovery.c:377:19: note: in expansion of macro 'NEXT_FREE_BLKADDR'
              |  377 |         blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
              |      |                   ^~~~~~~~~~~~~~~~~
              |
            'find_fsync_dnodes': event 5
              |
              |fs/f2fs/segment.h:71:46:
              |   71 |         (SM_I(sbi) ? SM_I(sbi)->seg0_blkaddr :                          \
              |      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
              |      |                                              |
              |      |                                              (5) ...to here
              |   72 |                 le32_to_cpu(F2FS_RAW_SUPER(sbi)->segment0_blkaddr))
              |      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/segment.h:86:34: note: in expansion of macro 'SEG0_BLKADDR'
              |   86 | #define START_BLOCK(sbi, segno) (SEG0_BLKADDR(sbi) +                    \
              |      |                                  ^~~~~~~~~~~~
   fs/f2fs/segment.h:90:10: note: in expansion of macro 'START_BLOCK'
              |   90 |         (START_BLOCK(sbi, (curseg)->segno) + (curseg)->next_blkoff)
              |      |          ^~~~~~~~~~~
   fs/f2fs/recovery.c:377:19: note: in expansion of macro 'NEXT_FREE_BLKADDR'
              |  377 |         blkaddr = NEXT_FREE_BLKADDR(sbi, curseg);
              |      |                   ^~~~~~~~~~~~~~~~~
              |
            'find_fsync_dnodes': event 6
              |
              |  392 |                         f2fs_put_page(page, 1);
              |      |                         ^~~~~~~~~~~~~~~~~~~~~~
              |      |                         |
              |      |                         (6) calling 'f2fs_put_page' from 'find_fsync_dnodes'
              |
              +--> 'f2fs_put_page': events 7-10
                     |
                     |fs/f2fs/f2fs.h:2750:20:
                     | 2750 | static inline void f2fs_put_page(struct page *page, int unlock)
                     |      |                    ^~~~~~~~~~~~~
                     |      |                    |
                     |      |                    (7) entry to 'f2fs_put_page'
                     | 2751 | {
                     | 2752 |         if (!page)
                     |      |            ~        
                     |      |            |
                     |      |            (8) following 'false' branch (when 'page' is non-NULL)...
                     |......
                     | 2755 |         if (unlock) {
                     |      |            ~        
                     |      |            |
                     |      |            (9) ...to here
                     |      |            (10) following 'true' branch (when 'unlock != 0')...
                     |
                   'f2fs_put_page': event 11
                     |
                     |include/asm-generic/rwonce.h:44:26:
                     |   44 | #define __READ_ONCE(x)  (*(const volatile __unqual_scalar_typeof(x) *)&(x))
                     |      |                         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     |      |                          |
                     |      |                          (11) ...to here
   include/asm-generic/rwonce.h:50:9: note: in expansion of macro '__READ_ONCE'
                     |   50 |         __READ_ONCE(x);                                                 \
                     |      |         ^~~~~~~~~~~
   include/linux/page-flags.h:253:30: note: in expansion of macro 'READ_ONCE'
                     |  253 |         unsigned long head = READ_ONCE(page->compound_head);

vim +/ino +2376 fs/f2fs/f2fs.h

dcbb4c10e6d9693 Joe Perches 2019-06-18  2374  
dcbb4c10e6d9693 Joe Perches 2019-06-18  2375  #define f2fs_err(sbi, fmt, ...)						\
dcbb4c10e6d9693 Joe Perches 2019-06-18 @2376  	f2fs_printk(sbi, KERN_ERR fmt, ##__VA_ARGS__)
dcbb4c10e6d9693 Joe Perches 2019-06-18  2377  #define f2fs_warn(sbi, fmt, ...)					\
dcbb4c10e6d9693 Joe Perches 2019-06-18  2378  	f2fs_printk(sbi, KERN_WARNING fmt, ##__VA_ARGS__)
dcbb4c10e6d9693 Joe Perches 2019-06-18  2379  #define f2fs_notice(sbi, fmt, ...)					\
dcbb4c10e6d9693 Joe Perches 2019-06-18  2380  	f2fs_printk(sbi, KERN_NOTICE fmt, ##__VA_ARGS__)
dcbb4c10e6d9693 Joe Perches 2019-06-18  2381  #define f2fs_info(sbi, fmt, ...)					\
dcbb4c10e6d9693 Joe Perches 2019-06-18  2382  	f2fs_printk(sbi, KERN_INFO fmt, ##__VA_ARGS__)
dcbb4c10e6d9693 Joe Perches 2019-06-18  2383  #define f2fs_debug(sbi, fmt, ...)					\
dcbb4c10e6d9693 Joe Perches 2019-06-18  2384  	f2fs_printk(sbi, KERN_DEBUG fmt, ##__VA_ARGS__)
dcbb4c10e6d9693 Joe Perches 2019-06-18  2385  

:::::: The code at line 2376 was first introduced by commit
:::::: dcbb4c10e6d9693cc9d6fa493b4d130b66a60c7d f2fs: introduce f2fs_<level> macros to wrap f2fs_printk()

:::::: TO: Joe Perches <joe@perches.com>
:::::: CC: Jaegeuk Kim <jaegeuk@kernel.org>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-15  0:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-15  0:55 [linux-next:master 6241/7172] fs/f2fs/f2fs.h:2376:9: warning: use of uninitialized value 'ino' [CWE-457] kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.