Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Enzo Matsumiya <ematsumiya@suse.de>
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com,
	ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, henrique.carvalho@suse.com
Subject: Re: [PATCH 7/8] smb: client: compress: add compress/common.h
Date: Mon, 20 Apr 2026 14:24:11 -0700	[thread overview]
Message-ID: <20260420212411.GA2260299@ax162> (raw)
In-Reply-To: <20260413190713.283939-7-ematsumiya@suse.de>

Hi Enzo,

On Mon, Apr 13, 2026 at 04:07:12PM -0300, Enzo Matsumiya wrote:
> Add compress/common.h to aggregate helpers and definitions that will be
> shared with other compression algorithms.
> 
> Also add a few build time checks for proper support.
> 
> Changes:
> - update affected call paths in compress/lz77.c
> 
> Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
> ---
...
> diff --git a/fs/smb/client/compress/common.h b/fs/smb/client/compress/common.h
> new file mode 100644
> index 000000000000..b5ccf5debd22
> --- /dev/null
> +++ b/fs/smb/client/compress/common.h
...
> +/*
> + * Build time checks/asserts.
> + * These are assumptions/expectations for all algorithms implemented.
> + */
> +#ifndef __LITTLE_ENDIAN /* TODO */
> +# error "SMB3 compression is only supported on little endian architectures"
> +#endif /* !__LITTLE_ENDIAN */
> +
> +#if BITS_PER_LONG < 64 /* TODO */
> +# error "SMB3 compression is only supported on 64-bit architectures"
> +#endif /* BITS_PER_LONG < 64 */
> +
> +/* Build time double checks (probably unnecessary) */
> +static_assert(sizeof(u16) == 2);
> +static_assert(sizeof(u32) == 4);
> +static_assert(sizeof(u64) == 8);
> +static_assert(sizeof(size_t) == 8);

Steve pushed this change into -next as commit 20a248d5e77a ("smb:
client: compress: add compress/common.h"), where it breaks the build for
many 32-bit architectures for obvious reasons:

  $ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mrproper allmodconfig fs/smb/
  In file included from fs/smb/client/compress/lz77.c:14:
  fs/smb/client/compress/common.h:34:3: error: #error "SMB3 compression is only supported on 64-bit architectures"
     34 | # error "SMB3 compression is only supported on 64-bit architectures"
        |   ^~~~~
  In file included from include/linux/init.h:5,
                   from include/linux/printk.h:6,
                   from include/asm-generic/bug.h:31,
                   from arch/arm/include/asm/bug.h:60,
                   from include/linux/bug.h:5,
                   from include/linux/slab.h:15,
                   from fs/smb/client/compress/lz77.c:9:
  include/linux/build_bug.h:80:41: error: static assertion failed: "sizeof(size_t) == 8"
     80 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
        |                                         ^~~~~~~~~~~~~~
  include/linux/build_bug.h:79:34: note: in expansion of macro '__static_assert'
     79 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
        |                                  ^~~~~~~~~~~~~~~
  fs/smb/client/compress/common.h:41:1: note: in expansion of macro 'static_assert'
     41 | static_assert(sizeof(size_t) == 8);
        | ^~~~~~~~~~~~~

It is unacceptable for the build to break in this manner in my opinion.
You should really use Kconfig to gate this code in a proper manner and
not emit any errors or warnings when it is unsupported.

Cheers,
Nathan

  reply	other threads:[~2026-04-20 21:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 19:07 [PATCH 1/8] smb: client: compress: fix buffer overrun in lz77_compress() Enzo Matsumiya
2026-04-13 19:07 ` [PATCH 2/8] smb: client: compress: fix bad encoding on last LZ77 flag Enzo Matsumiya
2026-04-19  1:35   ` Steve French
2026-04-13 19:07 ` [PATCH 3/8] smb: client: compress: fix counting in LZ77 match finding Enzo Matsumiya
2026-04-13 19:07 ` [PATCH 4/8] smb: client: compress: increase LZ77_MATCH_MAX_DIST Enzo Matsumiya
2026-04-13 19:07 ` [PATCH 5/8] smb: client: compress: LZ77 optimizations Enzo Matsumiya
2026-04-13 19:07 ` [PATCH 6/8] smb: client: compress: add code docs to lz77.c Enzo Matsumiya
2026-04-13 19:07 ` [PATCH 7/8] smb: client: compress: add compress/common.h Enzo Matsumiya
2026-04-20 21:24   ` Nathan Chancellor [this message]
2026-04-20 21:31     ` Steve French
2026-04-13 19:07 ` [PATCH 8/8] smb: common: add SMB3_COMPRESS_MAX_ALGS Enzo Matsumiya

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=20260420212411.GA2260299@ax162 \
    --to=nathan@kernel.org \
    --cc=bharathsm@microsoft.com \
    --cc=ematsumiya@suse.de \
    --cc=henrique.carvalho@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=ronniesahlberg@gmail.com \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).