From: Andrew Morton <akpm@linux-foundation.org>
To: Phillip Lougher <phillip@squashfs.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 00/23] Squashfs: fix a lot of AI issues and AI style issues
Date: Tue, 24 Nov 2026 21:52:27 -0800 [thread overview]
Message-ID: <20261124215227.e23732bb6d1e30b8721099b7@linux-foundation.org> (raw)
In-Reply-To: <20261125014737.347231-1-phillip@squashfs.org.uk>
On Wed, 25 Nov 2026 01:47:14 +0000 Phillip Lougher <phillip@squashfs.org.uk> wrote:
> Note: this is an intermediary patch-set, and not the final patch-set.
> It is intended to see if the issues Sashiko AI reported on the V3 patch-
> set have been dealt with in a way that stops the AI from complaining.
>
> If that has been achieved then the next step will be to deal wih
> additional issues raised by other AIs, and which could cause Sashiko to
> start complaining again.
>
> This is not so much see androids fighting but see androids conflicting
> which is much more boring. Your understanding is appreciated.
>
> This large patch-set is inspired by the recent spate of AI generated
> code reports. Four of the patches directly fix AI reported issues, and
> the rest have been found manually by a read-through and testing of the
> code.
Yeah, that's fair enough. It sucks that the only way to get Sashiko
review is to cc a mailing list. But it's for good reasons - Sashiko is
already costing Google a ton of money and permitting people to use it
privately would permit all sorts of abuse.
I've suggested ways to get around this, such as "if sender has N
commits in the past M time then permit private review" but that idea
hasn't gone anywhere,
So the unhappy compromise is for Author to conduct their private
conversation with Sashiko while the rest of us are spectators.
Fortunately nobody reads linux-kernel any more ;)
Thanks, I've updated mm.git's mm-nonmm-unstable branch (and hence
linux-next) to this version.
Here's how v4 altered mm.git:
fs/squashfs/dir.c | 18 +++++++++---------
fs/squashfs/file.c | 8 +++-----
fs/squashfs/inode.c | 8 ++++++++
fs/squashfs/namei.c | 15 ++++++++-------
fs/squashfs/squashfs_fs.h | 3 +++
fs/squashfs/squashfs_fs_i.h | 1 +
6 files changed, 32 insertions(+), 21 deletions(-)
--- a/fs/squashfs/dir.c~b
+++ a/fs/squashfs/dir.c
@@ -79,10 +79,11 @@ static unsigned int get_dir_index_using_
/* Sanity check the directory index contents */
- /* size should never be larger than SQUASHFS_NAME_LEN */
- size = le32_to_cpu(dir_index.size) + 1;
- if (size > SQUASHFS_NAME_LEN)
+ /* size should never be larger than SQUASHFS_DISK_NAME_LEN */
+ size = le32_to_cpu(dir_index.size);
+ if (size > SQUASHFS_DISK_NAME_LEN)
break;
+ ++ size;
/* The stored index should not be larger than max_index */
index = le32_to_cpu(dir_index.index);
@@ -226,13 +227,13 @@ static int squashfs_readdir(struct file
goto failed_read;
length += sizeof(*dire);
- size = le16_to_cpu(dire->size) + 1;
+ size = le16_to_cpu(dire->size);
- /* size should never be larger than SQUASHFS_NAME_LEN */
- if (size > SQUASHFS_NAME_LEN)
+ /* size should never be larger than SQUASHFS_DISK_NAME_LEN */
+ if (size > SQUASHFS_DISK_NAME_LEN)
goto failed_read;
- if (!squashfs_dir_space(inode, length, size))
+ if (!squashfs_dir_space(inode, length, ++ size))
goto failed_read;
err = squashfs_read_metadata(inode->i_sb, dire->name,
@@ -262,9 +263,8 @@ static int squashfs_readdir(struct file
}
}
- kfree(dire);
-
finish:
+ kfree(dire);
return 0;
failed_read:
--- a/fs/squashfs/file.c~b
+++ a/fs/squashfs/file.c
@@ -492,8 +492,7 @@ static int squashfs_read_folio(struct fi
PAGE_SHIFT))
goto out;
- if (index < file_end || squashfs_i(inode)->fragment_block ==
- SQUASHFS_INVALID_BLK) {
+ if (index < file_end || !squashfs_i(inode)->has_fragment) {
u64 block = 0;
res = read_blocklist(inode, index, &block);
@@ -633,7 +632,7 @@ static void squashfs_readahead(struct re
goto skip_pages;
if (start >> msblk->block_log == file_end &&
- squashfs_i(inode)->fragment_block != SQUASHFS_INVALID_BLK) {
+ squashfs_i(inode)->has_fragment) {
res = squashfs_readahead_fragment(inode, pages,
nr_pages, expected, start);
if (res)
@@ -707,8 +706,7 @@ static loff_t seek_hole_data(struct file
return -ENXIO;
/* is offset within tailend and is tailend packed into a fragment? */
- if (index + 1 == file_end &&
- squashfs_i(inode)->fragment_block != SQUASHFS_INVALID_BLK) {
+ if (index + 1 == file_end && squashfs_i(inode)->has_fragment) {
if (whence == SEEK_DATA)
return offset;
--- a/fs/squashfs/inode.c~b
+++ a/fs/squashfs/inode.c
@@ -136,6 +136,7 @@ int squashfs_read_inode(struct inode *in
type = le16_to_cpu(sqshb_ino->inode_type);
switch (type) {
case SQUASHFS_REG_TYPE: {
+ char has_fragment;
unsigned int frag_offset, frag;
int frag_size;
u64 frag_blk;
@@ -161,7 +162,9 @@ int squashfs_read_inode(struct inode *in
err = squashfs_frag_lookup(sb, frag, &frag_blk, &frag_size);
if (err < 0)
goto failed_read;
+ has_fragment = true;
} else {
+ has_fragment = false;
frag_blk = SQUASHFS_INVALID_BLK;
frag_size = 0;
frag_offset = 0;
@@ -171,6 +174,7 @@ int squashfs_read_inode(struct inode *in
inode->i_fop = &squashfs_file_operations;
inode->i_mode |= S_IFREG;
inode->i_blocks = ((inode->i_size - 1) >> 9) + 1;
+ squashfs_i(inode)->has_fragment = has_fragment;
squashfs_i(inode)->fragment_block = frag_blk;
squashfs_i(inode)->fragment_size = frag_size;
squashfs_i(inode)->fragment_offset = frag_offset;
@@ -187,6 +191,7 @@ int squashfs_read_inode(struct inode *in
break;
}
case SQUASHFS_LREG_TYPE: {
+ char has_fragment;
unsigned int frag_offset, frag;
int frag_size;
u64 frag_blk;
@@ -216,7 +221,9 @@ int squashfs_read_inode(struct inode *in
err = squashfs_frag_lookup(sb, frag, &frag_blk, &frag_size);
if (err < 0)
goto failed_read;
+ has_fragment = true;
} else {
+ has_fragment = false;
frag_blk = SQUASHFS_INVALID_BLK;
frag_size = 0;
frag_offset = 0;
@@ -230,6 +237,7 @@ int squashfs_read_inode(struct inode *in
inode->i_blocks = (inode->i_size -
le64_to_cpu(sqsh_ino->sparse) + 511) >> 9;
+ squashfs_i(inode)->has_fragment = has_fragment;
squashfs_i(inode)->fragment_block = frag_blk;
squashfs_i(inode)->fragment_size = frag_size;
squashfs_i(inode)->fragment_offset = frag_offset;
--- a/fs/squashfs/namei.c~b
+++ a/fs/squashfs/namei.c
@@ -108,10 +108,11 @@ static unsigned int get_dir_index_using_
/* Sanity check the directory index contents */
- /* size should never be larger than SQUASHFS_NAME_LEN */
- size = le32_to_cpu(dir_index->size) + 1;
- if (size > SQUASHFS_NAME_LEN)
+ /* size should never be larger than SQUASHFS_DISK_NAME_LEN */
+ size = le32_to_cpu(dir_index->size);
+ if (size > SQUASHFS_DISK_NAME_LEN)
break;
+ ++ size;
/* The stored index should not be larger than max_index */
index = le32_to_cpu(dir_index->index);
@@ -236,13 +237,13 @@ static struct dentry *squashfs_lookup(st
goto read_failure;
length += sizeof(*dire);
- size = le16_to_cpu(dire->size) + 1;
+ size = le16_to_cpu(dire->size);
- /* size should never be larger than SQUASHFS_NAME_LEN */
- if (size > SQUASHFS_NAME_LEN)
+ /* size should never be larger than SQUASHFS_DISK_NAME_LEN */
+ if (size > SQUASHFS_DISK_NAME_LEN)
goto data_error;
- if (!squashfs_dir_space(dir, length, size))
+ if (!squashfs_dir_space(dir, length, ++ size))
goto data_error;
err = squashfs_read_metadata(dir->i_sb, dire->name,
--- a/fs/squashfs/squashfs_fs.h~b
+++ a/fs/squashfs/squashfs_fs.h
@@ -32,6 +32,9 @@
/* Max length of filename (not 255) */
#define SQUASHFS_NAME_LEN 256
+/* Max on-disk length of filename */
+#define SQUASHFS_DISK_NAME_LEN 255
+
/* Max value for directory header count*/
#define SQUASHFS_DIR_COUNT 256
--- a/fs/squashfs/squashfs_fs_i.h~b
+++ a/fs/squashfs/squashfs_fs_i.h
@@ -17,6 +17,7 @@ struct squashfs_inode_info {
unsigned int xattr_size;
unsigned int xattr_count;
int parent;
+ bool has_fragment;
union {
struct {
u64 fragment_block;
_
prev parent reply other threads:[~2026-11-25 5:52 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 1:47 Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 01/23] Squashfs: convert SQUASHFS_COMPRESSED_* to inline functions Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 02/23] Squashfs: convert SQUASHFS_INODE_* and SQUASHFS_MKINODE " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 03/23] Squashfs: convert SQUASHFS_FRAGMENT_* " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 04/23] Squashfs: convert SQUASHFS_LOOKUP_* " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 05/23] Squashfs: convert SQUASHFS_ID_* " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 06/23] Squashfs: convert SQUASHFS_XATTR_* " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 07/23] Squashfs: fix offset in squashfs_read_inode() TRACE statements Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 08/23] Squashfs: don't compute start or alloc memory on empty directory or index Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 09/23] Squashfs: fix fragment bytes overflow on 32-bit architectures Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 10/23] Squashfs: fix fragment index table length too large exploit Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 11/23] Squashfs: sanity check inode metadata block location Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 12/23] Squashfs: sanity check directory " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 13/23] Squashfs: widen xattr count variables and add sanity check Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 14/23] Squashfs: very large files can exceed an int or size_t Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 15/23] Squashfs: add more sanity checking to squashfs_block_size() Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 16/23] Squashfs: sanity check fragment block location and range Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 17/23] Squashfs: sanity check block list sizes " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 18/23] Squashfs: don't store large export table indexes in memory Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 19/23] Squashfs: don't store large fragment " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 20/23] Squashfs: don't store large xattr id " Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 21/23] Squashfs: fix variables in directory code and add more sanity checks Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 22/23] Squashfs: fix regression in squashfs_copy_cache() Phillip Lougher
2026-11-25 1:47 ` [PATCH v4 23/23] Squashfs: check index isn't greater than S64_MAX in squashfs_read_data() Phillip Lougher
2026-11-25 5:52 ` Andrew Morton [this message]
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=20261124215227.e23732bb6d1e30b8721099b7@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--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®