From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: fs/exfat/dir.c:874 exfat_get_dentry_set() warn: missing unwind goto?
Date: Sun, 5 Nov 2023 16:35:21 +0800 [thread overview]
Message-ID: <202311051636.4EVHtc18-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Yuezhang Mo <Yuezhang.Mo@sony.com>
CC: Namjae Jeon <linkinjeon@kernel.org>
CC: Andy Wu <Andy.Wu@sony.com>
CC: Aoyama Wataru <wataru.aoyama@sony.com>
CC: Sungjong Seo <sj1557.seo@samsung.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: aea6bf908d730b01bd264a8821159db9463c111c
commit: 20914ff6dd56dd6b548bf5dd90bff09ef89999e4 exfat: move exfat_entry_set_cache from heap to stack
date: 11 months ago
:::::: branch date: 13 hours ago
:::::: commit date: 11 months ago
config: i386-randconfig-141-20231103 (https://download.01.org/0day-ci/archive/20231105/202311051636.4EVHtc18-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231105/202311051636.4EVHtc18-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202311051636.4EVHtc18-lkp@intel.com/
New smatch warnings:
fs/exfat/dir.c:874 exfat_get_dentry_set() warn: missing unwind goto?
Old smatch warnings:
fs/exfat/dir.c:163 exfat_readdir() warn: passing freed memory 'bh'
fs/exfat/dir.c:484 exfat_init_dir_entry() warn: passing freed memory 'bh'
fs/exfat/dir.c:549 exfat_init_ext_entry() warn: passing freed memory 'bh'
fs/exfat/dir.c:558 exfat_init_ext_entry() warn: passing freed memory 'bh'
vim +874 fs/exfat/dir.c
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 802
ca06197382bde0 Namjae Jeon 2020-03-02 803 /*
ca06197382bde0 Namjae Jeon 2020-03-02 804 * Returns a set of dentries for a file or dir.
ca06197382bde0 Namjae Jeon 2020-03-02 805 *
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 806 * Note It provides a direct pointer to bh->data via exfat_get_dentry_cached().
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 807 * User should call exfat_get_dentry_set() after setting 'modified' to apply
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 808 * changes made in this entry set to the real device.
ca06197382bde0 Namjae Jeon 2020-03-02 809 *
ca06197382bde0 Namjae Jeon 2020-03-02 810 * in:
ca06197382bde0 Namjae Jeon 2020-03-02 811 * sb+p_dir+entry: indicates a file/dir
ca06197382bde0 Namjae Jeon 2020-03-02 812 * type: specifies how many dentries should be included.
ca06197382bde0 Namjae Jeon 2020-03-02 813 * return:
ca06197382bde0 Namjae Jeon 2020-03-02 814 * pointer of entry set on success,
ca06197382bde0 Namjae Jeon 2020-03-02 815 * NULL on failure.
ca06197382bde0 Namjae Jeon 2020-03-02 816 */
20914ff6dd56dd Yuezhang Mo 2022-11-17 817 int exfat_get_dentry_set(struct exfat_entry_set_cache *es,
20914ff6dd56dd Yuezhang Mo 2022-11-17 818 struct super_block *sb, struct exfat_chain *p_dir, int entry,
20914ff6dd56dd Yuezhang Mo 2022-11-17 819 unsigned int type)
ca06197382bde0 Namjae Jeon 2020-03-02 820 {
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 821 int ret, i, num_bh;
ca06197382bde0 Namjae Jeon 2020-03-02 822 unsigned int off, byte_offset, clu = 0;
ca06197382bde0 Namjae Jeon 2020-03-02 823 sector_t sec;
ca06197382bde0 Namjae Jeon 2020-03-02 824 struct exfat_sb_info *sbi = EXFAT_SB(sb);
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 825 struct exfat_dentry *ep;
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 826 int num_entries;
ca06197382bde0 Namjae Jeon 2020-03-02 827 enum exfat_validate_dentry_mode mode = ES_MODE_STARTED;
ca06197382bde0 Namjae Jeon 2020-03-02 828 struct buffer_head *bh;
ca06197382bde0 Namjae Jeon 2020-03-02 829
ca06197382bde0 Namjae Jeon 2020-03-02 830 if (p_dir->dir == DIR_DELETED) {
d1727d55c0327e Joe Perches 2020-04-24 831 exfat_err(sb, "access to deleted dentry");
20914ff6dd56dd Yuezhang Mo 2022-11-17 832 return -EIO;
ca06197382bde0 Namjae Jeon 2020-03-02 833 }
ca06197382bde0 Namjae Jeon 2020-03-02 834
ca06197382bde0 Namjae Jeon 2020-03-02 835 byte_offset = EXFAT_DEN_TO_B(entry);
ca06197382bde0 Namjae Jeon 2020-03-02 836 ret = exfat_walk_fat_chain(sb, p_dir, byte_offset, &clu);
ca06197382bde0 Namjae Jeon 2020-03-02 837 if (ret)
20914ff6dd56dd Yuezhang Mo 2022-11-17 838 return ret;
ca06197382bde0 Namjae Jeon 2020-03-02 839
20914ff6dd56dd Yuezhang Mo 2022-11-17 840 memset(es, 0, sizeof(*es));
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 841 es->sb = sb;
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 842 es->modified = false;
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 843
ca06197382bde0 Namjae Jeon 2020-03-02 844 /* byte offset in cluster */
ca06197382bde0 Namjae Jeon 2020-03-02 845 byte_offset = EXFAT_CLU_OFFSET(byte_offset, sbi);
ca06197382bde0 Namjae Jeon 2020-03-02 846
ca06197382bde0 Namjae Jeon 2020-03-02 847 /* byte offset in sector */
ca06197382bde0 Namjae Jeon 2020-03-02 848 off = EXFAT_BLK_OFFSET(byte_offset, sb);
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 849 es->start_off = off;
a3ff29a95fde16 Yuezhang Mo 2022-11-09 850 es->bh = es->__bh;
ca06197382bde0 Namjae Jeon 2020-03-02 851
ca06197382bde0 Namjae Jeon 2020-03-02 852 /* sector offset in cluster */
ca06197382bde0 Namjae Jeon 2020-03-02 853 sec = EXFAT_B_TO_BLK(byte_offset, sb);
ca06197382bde0 Namjae Jeon 2020-03-02 854 sec += exfat_cluster_to_sector(sbi, clu);
ca06197382bde0 Namjae Jeon 2020-03-02 855
ca06197382bde0 Namjae Jeon 2020-03-02 856 bh = sb_bread(sb, sec);
ca06197382bde0 Namjae Jeon 2020-03-02 857 if (!bh)
20914ff6dd56dd Yuezhang Mo 2022-11-17 858 return -EIO;
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 859 es->bh[es->num_bh++] = bh;
ca06197382bde0 Namjae Jeon 2020-03-02 860
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 861 ep = exfat_get_dentry_cached(es, 0);
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 862 if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode))
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 863 goto free_es;
ca06197382bde0 Namjae Jeon 2020-03-02 864
ca06197382bde0 Namjae Jeon 2020-03-02 865 num_entries = type == ES_ALL_ENTRIES ?
ca06197382bde0 Namjae Jeon 2020-03-02 866 ep->dentry.file.num_ext + 1 : type;
ca06197382bde0 Namjae Jeon 2020-03-02 867 es->num_entries = num_entries;
ca06197382bde0 Namjae Jeon 2020-03-02 868
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 869 num_bh = EXFAT_B_TO_BLK_ROUND_UP(off + num_entries * DENTRY_SIZE, sb);
a3ff29a95fde16 Yuezhang Mo 2022-11-09 870 if (num_bh > ARRAY_SIZE(es->__bh)) {
a3ff29a95fde16 Yuezhang Mo 2022-11-09 871 es->bh = kmalloc_array(num_bh, sizeof(*es->bh), GFP_KERNEL);
a3ff29a95fde16 Yuezhang Mo 2022-11-09 872 if (!es->bh) {
a3ff29a95fde16 Yuezhang Mo 2022-11-09 873 brelse(bh);
20914ff6dd56dd Yuezhang Mo 2022-11-17 @874 return -ENOMEM;
a3ff29a95fde16 Yuezhang Mo 2022-11-09 875 }
a3ff29a95fde16 Yuezhang Mo 2022-11-09 876 es->bh[0] = bh;
a3ff29a95fde16 Yuezhang Mo 2022-11-09 877 }
a3ff29a95fde16 Yuezhang Mo 2022-11-09 878
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 879 for (i = 1; i < num_bh; i++) {
ca06197382bde0 Namjae Jeon 2020-03-02 880 /* get the next sector */
ca06197382bde0 Namjae Jeon 2020-03-02 881 if (exfat_is_last_sector_in_cluster(sbi, sec)) {
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 882 if (p_dir->flags == ALLOC_NO_FAT_CHAIN)
ca06197382bde0 Namjae Jeon 2020-03-02 883 clu++;
ca06197382bde0 Namjae Jeon 2020-03-02 884 else if (exfat_get_next_cluster(sb, &clu))
ca06197382bde0 Namjae Jeon 2020-03-02 885 goto free_es;
ca06197382bde0 Namjae Jeon 2020-03-02 886 sec = exfat_cluster_to_sector(sbi, clu);
ca06197382bde0 Namjae Jeon 2020-03-02 887 } else {
ca06197382bde0 Namjae Jeon 2020-03-02 888 sec++;
ca06197382bde0 Namjae Jeon 2020-03-02 889 }
ca06197382bde0 Namjae Jeon 2020-03-02 890
ca06197382bde0 Namjae Jeon 2020-03-02 891 bh = sb_bread(sb, sec);
ca06197382bde0 Namjae Jeon 2020-03-02 892 if (!bh)
ca06197382bde0 Namjae Jeon 2020-03-02 893 goto free_es;
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 894 es->bh[es->num_bh++] = bh;
ca06197382bde0 Namjae Jeon 2020-03-02 895 }
ca06197382bde0 Namjae Jeon 2020-03-02 896
6fa96cd5ad7a0c Christophe Vu-Brugier 2021-11-02 897 /* validate cached dentries */
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 898 for (i = 1; i < num_entries; i++) {
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 899 ep = exfat_get_dentry_cached(es, i);
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 900 if (!exfat_validate_entry(exfat_get_entry_type(ep), &mode))
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 901 goto free_es;
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 902 }
20914ff6dd56dd Yuezhang Mo 2022-11-17 903 return 0;
ca06197382bde0 Namjae Jeon 2020-03-02 904
ca06197382bde0 Namjae Jeon 2020-03-02 905 free_es:
943af1fdacfebe Tetsuhiro Kohada 2020-05-20 906 exfat_free_dentry_set(es, false);
20914ff6dd56dd Yuezhang Mo 2022-11-17 907 return -EIO;
ca06197382bde0 Namjae Jeon 2020-03-02 908 }
ca06197382bde0 Namjae Jeon 2020-03-02 909
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-11-05 8:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-05 8:35 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-09-17 12:27 fs/exfat/dir.c:874 exfat_get_dentry_set() warn: missing unwind goto? kernel test robot
2022-12-23 8:26 kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202311051636.4EVHtc18-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.