Re: [PATCH 03/18] Squashfs: convert SQUASHFS_FRAGMENT_* to inline functions
From: Phillip Lougher
Date: Wed Nov 11 2026 - 21:21:57 EST
On Wed, 11 Nov 2026 17:13:02 -0800
Joe Perches <joe@xxxxxxxxxxx> wrote:
> On 2026-11-11 15:59, Phillip Lougher wrote:
> > On Sat, 07 Nov 2026 02:05:28 -0800
> > Joe Perches <joe@xxxxxxxxxxx> wrote:
> >
> >> On Sat, 2026-11-07 at 05:28 +0000, Phillip Lougher wrote:
> >> > Convert old fashioned #define macros into inline functions. This has
> >> > the following improvements:
> >> >
> >> > 1. Inline functions are typed, which makes the width and sigedness of
> >> > input and outputs explicit, which reduces errors.
> >> []
> >> > diff --git a/fs/squashfs/squashfs_helpers.h b/fs/squashfs/squashfs_helpers.h
> >> []
> >> > @@ -51,4 +51,31 @@ static inline s64 squashfs_mkinode(u32 start, u16 offset)
> >> > {
> >> > return ((s64)start << 16) | offset;
> >> > }
> >> > +
> >> > +/* fragment and fragment table defines */
> >> > +static inline s64 squashfs_fragment_bytes(u32 fragments)
> >> > +{
> >> > + return fragments * sizeof(struct squashfs_fragment_entry);
> >>
> >> Needs a cast to make the multiply work properly no?
> >>
> >> return (s64)fragments * sizeof(struct squashfs_fragment_entry);
> >
> > That is fixed in patch 7 (in the original patch-set). This is because
> > it was reported by an AI and so it is fixed in a separate patch with
> > an explanation of exploit and reproducer.
>
> Should be corrected the first time instead.
Shrug, I disagree.
The purpose of that patch is to convert the helpers to inline functions,
and only that. To do more than that is to do more than what the
commit message says, and in effect it will be adding a bug fix without
explanation or reproducer by the back-door.
Mixing code improvements and bug fixes in a single patch is always a bad
thing to do. If things break, having done multiple things in a single
patch, you can't determine whether it is the code improvements or the
bug fix that broke things, which breaks bisectability.
Phillip
--
Phillip Lougher <phillip@xxxxxxxxxxxxxxx>