Re: [PATCH 03/18] Squashfs: convert SQUASHFS_FRAGMENT_* to inline functions

From: Joe Perches

Date: Wed Nov 11 2026 - 20:15:44 EST


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.