From: kernel test robot <lkp@intel.com>
To: Phillip Lougher <phillip@squashfs.org.uk>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Phillip Lougher <phillip@squashfs.org.uk>
Subject: Re: [PATCH 10/18] Squashfs: sanity check directory metadata block location
Date: Sun, 8 Nov 2026 09:36:22 +0800 [thread overview]
Message-ID: <202611080942.VKgPZf4A-lkp@intel.com> (raw)
In-Reply-To: <20261107052843.725239-11-phillip@squashfs.org.uk>
Hi Phillip,
kernel test robot noticed the following build warnings:
[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v7.4-rc1]
[cannot apply to akpm-mm/mm-everything next-20261105]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Phillip-Lougher/Squashfs-convert-SQUASHFS_COMPRESSED_-to-inline-functions/20261107-052826
base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/r/20261107052843.725239-11-phillip%40squashfs.org.uk
patch subject: [PATCH 10/18] Squashfs: sanity check directory metadata block location
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20261108/202611080942.VKgPZf4A-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project fc9576e3b179738d99c5babe5cd9d6c1f883e0db)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261108/202611080942.VKgPZf4A-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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611080942.VKgPZf4A-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> fs/squashfs/namei.c:141:6: warning: variable 'dire' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
141 | if (block < 0)
| ^~~~~~~~~
fs/squashfs/namei.c:231:8: note: uninitialized use occurs here
231 | kfree(dire);
| ^~~~
fs/squashfs/namei.c:141:2: note: remove the 'if' if its condition is always false
141 | if (block < 0)
| ^~~~~~~~~~~~~~
142 | goto data_error;
| ~~~~~~~~~~~~~~~
fs/squashfs/namei.c:133:33: note: initialize the variable 'dire' to silence this warning
133 | struct squashfs_dir_entry *dire;
| ^
| = NULL
1 warning generated.
vim +141 fs/squashfs/namei.c
123
124
125 static struct dentry *squashfs_lookup(struct inode *dir, struct dentry *dentry,
126 unsigned int flags)
127 {
128 const unsigned char *name = dentry->d_name.name;
129 int len = dentry->d_name.len;
130 struct inode *inode = NULL;
131 struct squashfs_sb_info *msblk = dir->i_sb->s_fs_info;
132 struct squashfs_dir_header dirh;
133 struct squashfs_dir_entry *dire;
134 u64 block = squashfs_dir_start(squashfs_i(dir)->start, msblk);
135 int offset = squashfs_i(dir)->offset;
136 int err, length;
137 unsigned int dir_count, size;
138
139 TRACE("Entered squashfs_lookup [%llx:%x]\n", squashfs_i(dir)->start, offset);
140
> 141 if (block < 0)
142 goto data_error;
143
144 dire = kmalloc(sizeof(*dire) + SQUASHFS_NAME_LEN + 1, GFP_KERNEL);
145 if (dire == NULL) {
146 ERROR("Failed to allocate squashfs_dir_entry\n");
147 return ERR_PTR(-ENOMEM);
148 }
149
150 if (len > SQUASHFS_NAME_LEN) {
151 err = -ENAMETOOLONG;
152 goto failed;
153 }
154
155 length = get_dir_index_using_name(dir->i_sb, &block, &offset,
156 squashfs_i(dir)->dir_idx_start,
157 squashfs_i(dir)->dir_idx_offset,
158 squashfs_i(dir)->dir_idx_cnt, name);
159
160 while (length < i_size_read(dir)) {
161 /*
162 * Read directory header.
163 */
164 err = squashfs_read_metadata(dir->i_sb, &dirh, &block,
165 &offset, sizeof(dirh));
166 if (err < 0)
167 goto read_failure;
168
169 length += sizeof(dirh);
170
171 dir_count = le32_to_cpu(dirh.count) + 1;
172
173 if (dir_count > SQUASHFS_DIR_COUNT)
174 goto data_error;
175
176 while (dir_count--) {
177 /*
178 * Read directory entry.
179 */
180 err = squashfs_read_metadata(dir->i_sb, dire, &block,
181 &offset, sizeof(*dire));
182 if (err < 0)
183 goto read_failure;
184
185 size = le16_to_cpu(dire->size) + 1;
186
187 /* size should never be larger than SQUASHFS_NAME_LEN */
188 if (size > SQUASHFS_NAME_LEN)
189 goto data_error;
190
191 err = squashfs_read_metadata(dir->i_sb, dire->name,
192 &block, &offset, size);
193 if (err < 0)
194 goto read_failure;
195
196 length += sizeof(*dire) + size;
197
198 if (name[0] < dire->name[0])
199 goto exit_lookup;
200
201 if (len == size && !strncmp(name, dire->name, len)) {
202 unsigned int blk, off, ino_num;
203 long long ino;
204 blk = le32_to_cpu(dirh.start_block);
205 off = le16_to_cpu(dire->offset);
206 ino_num = le32_to_cpu(dirh.inode_number) +
207 (short) le16_to_cpu(dire->inode_number);
208 ino = squashfs_mkinode(blk, off);
209
210 TRACE("calling squashfs_iget for directory "
211 "entry %s, inode %x:%x, %d\n", name,
212 blk, off, ino_num);
213
214 inode = squashfs_iget(dir->i_sb, ino, ino_num);
215 goto exit_lookup;
216 }
217 }
218 }
219
220 exit_lookup:
221 kfree(dire);
222 return d_splice_alias(inode, dentry);
223
224 data_error:
225 err = -EIO;
226
227 read_failure:
228 ERROR("Unable to read directory block [%llx:%x]\n",
229 squashfs_i(dir)->start, squashfs_i(dir)->offset);
230 failed:
231 kfree(dire);
232 return ERR_PTR(err);
233 }
234
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-11-08 1:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 5:28 [PATCH 00/18] Squashfs: fix a lot of AI issues and AI style issues Phillip Lougher
2026-11-07 5:28 ` [PATCH 01/18] Squashfs: convert SQUASHFS_COMPRESSED_* to inline functions Phillip Lougher
2026-11-07 5:28 ` [PATCH 02/18] Squashfs: convert SQUASHFS_INODE_* and SQUASHFS_MKINODE " Phillip Lougher
2026-11-07 5:28 ` [PATCH 03/18] Squashfs: convert SQUASHFS_FRAGMENT_* " Phillip Lougher
2026-11-07 10:05 ` Joe Perches
2026-11-07 5:28 ` [PATCH 04/18] Squashfs: convert SQUASHFS_LOOKUP_* " Phillip Lougher
2026-11-07 5:28 ` [PATCH 05/18] Squashfs: convert SQUASHFS_ID_* " Phillip Lougher
2026-11-07 5:28 ` [PATCH 06/18] Squashfs: convert SQUASHFS_XATTR_* " Phillip Lougher
2026-11-07 5:28 ` [PATCH 07/18] Squashfs: fix fragment bytes overflow on 32-bit architectures Phillip Lougher
2026-11-07 5:28 ` [PATCH 08/18] Squashfs: fix fragment index table length too large exploit Phillip Lougher
2026-11-07 5:28 ` [PATCH 09/18] Squashfs: sanity check inode metadata block location Phillip Lougher
2026-11-07 22:47 ` kernel test robot
2026-11-07 5:28 ` [PATCH 10/18] Squashfs: sanity check directory " Phillip Lougher
2026-11-08 1:36 ` kernel test robot [this message]
2026-11-07 5:28 ` [PATCH 11/18] Squashfs: widen xattr count variables and add sanity check Phillip Lougher
2026-11-07 5:28 ` [PATCH 12/18] Squashfs: very large files can exceed an int block count Phillip Lougher
2026-11-07 5:28 ` [PATCH 13/18] Squashfs: add more sanity checking to squashfs_block_size() Phillip Lougher
2026-11-07 5:28 ` [PATCH 14/18] Squashfs: sanity check fragment block location and range Phillip Lougher
2026-11-07 5:28 ` [PATCH 15/18] Squashfs: sanity check block list sizes " Phillip Lougher
2026-11-07 5:28 ` [PATCH 16/18] Squashfs: don't store large export table indexes in memory Phillip Lougher
2026-11-07 5:28 ` [PATCH 17/18] Squashfs: don't store large fragment " Phillip Lougher
2026-11-07 5:28 ` [PATCH 18/18] Squashfs: don't store large xattr id " Phillip Lougher
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=202611080942.VKgPZf4A-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=phillip@squashfs.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®