From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr2-f35.google.com (mail-wr2-f35.google.com [74.125.225.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C65D3360EF0 for ; Sun, 4 Oct 2026 08:34:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.99 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791102843; cv=none; b=UAsZMPccZwGZE6ScnxinfcLm0g79N7NziAPinPI6NRklc2khoDfvvGi2QQGP0D4EUK5UpkXXepc6fjHJA8nhbP7EDISslhx7nge50H06YdNUeL+Wlc0qX8XmekYhSIC3V1a7W76vD9FBLNh7++mzwbuFXFldB/Cy1sblRVvrhOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791102843; c=relaxed/simple; bh=1sBv2SI3wnHyVQDHUJVigmIehBQG6EXZHnsM+TL5srs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NWh6tNneDyHbudRjKwkdpJsfOpPTjQHtS3F5d0lLnP+Go9Q237ct3k1s2uQTVVhDKk91neWAc+pssNjrFezcxoM8gkxYvyu4lvBUiTinD+s48vSYJnnitsVphsZapPNkhTtAFSCCW9BY373WahZlQ3ZOL1Eu4KL51TvvvObleNE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NdkAUfd2; arc=none smtp.client-ip=74.125.225.99 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NdkAUfd2" Received: by mail-wr2-f35.google.com with SMTP id ffacd0b85a97d-488811c9ebaso332237f8f.2 for ; Sun, 04 Oct 2026 01:34:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791102840; x=1791707640; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=0HFDC0D77tUqEmXehAlYyAx2E0DK1wOzX1zKg1ym3bo=; b=NdkAUfd2+KZTf3s9hEpqKwliTej8peJLCSWDISLUjLwt09egN/aiRz2XZCkpPnIhNC aK2B8KkXrAsfSf5UqEl+SqvFza5LHgVUqAccsIdsuUTmlR+g8Uea5bMpAzd2qbdFBiCg t8fADBhEweXTv2ZNQgB7eZ1zF3dsFM6vncUf/ADRkOjyLLHTRGIDP4eOp+lBBA8JuXeu nBJoxu6110IVlbTfAnaegRILWMJ2WNttnECN9/fl0pH8w6q6eG9C43JEnC4p9zNrOs3x cGQa4jIxiwUPFj88RAfsTL3tjVtRaEeC2g1Rjy8xyoFrbRQsWvwMztVhAx2Ih1bK6nsb 4faQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791102840; x=1791707640; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0HFDC0D77tUqEmXehAlYyAx2E0DK1wOzX1zKg1ym3bo=; b=y10EEHeG2tGk/2SSEdrqoNmnhGQG5PsDGTlyaUV71QPaJIwT/lT9zhieLAIxECBelo RJHO3CK43QzdNKEtNK3VnAsaT85RvBEzHUx7ixGQS+sJzF5PQF0M/NeU/2yuV87g4Q5O ZS3mVBs+HD1Zn6X+si4P7jIwFkdQQp4ZZ3ez6mXhBei4TKUfynMsjKI2gT+j8aVEW0lQ 8o+I8I5IqLs7NWfE40qyXK6U/4r0f/kO92QGzffDlKE8yPhTbo2KOza39x08dtmHkvDi yzmCQ7rEjISpLh1IUGYiyo1+1ndjqdtpyvDrUC6UV/yUcwnrjKMnfagBs5gmFHyzw4Iy w7bQ== X-Forwarded-Encrypted: i=1; AKwUvBw4XYkOxG2C8T4KXmlnH0+xS2Bj5ztTW1c3KojIi3RRvjLIY8XlYI0y3lmcZwnU0MYD8oE3tJ/hdM33@vger.kernel.org X-Gm-Message-State: AFq9FYIcq6jUc5P6CzwxQcvf1ZZ2KNdTF+wiXVKJ8fPIW2GtQmY5dY9U cZQlrIaEUhXP8Y3+JBZC7LmwvT71KBadCln5lLukaqeLGwwxOXq6SyWN X-Gm-Gg: AYBFou1BRwoJPG+aQX06JcT0fViMbrV9qNqm23fMoROK9b8jfb1m3F9xK1Xn/I04H6V NyttF/mHdcxK/AH81ENnV3CtC0C4qQabdzldfFH+jVOGUswHnaX5p/V6FXjEXt0qtb2xOeonE4C gVF1gzjRDb26fGXTNTjCbpnVeFqI9DdzG7a+kVGBLThrSDC1Ju7Mz8OxoCP2saF9ps88NtDHkSc rK3D/CHE/enLY2OSLzkXG7r8qRhYeWHUD+/MjW0mxbbEVNBxTLsJ+gDFyiH3pFf5EWKVZSH5PT0 +ydex1jw1ZmsIwcVbp8ktZugHSoPYH9C40ybrf4N1vTNT6khJqjdzTu/Xfp0DAEj0jkOry29KLF DsTbtrzRlHYrm4bKMqhb7kNoHPHtql99M8oGX/mNpEhTsFResIEpwD3vapQ6EmvIh0ZWA4s/ghh vlFePdbWYNrpjQm43ZejOpjVB8YjHMxodx8aew6X8A9D9i/p+1BOZHDL6ldkY+NmQlk7qa3yxz4 ejR57ExFratTiEgGS4K2NSsgrYXkxVZfLO4QZGvsFzKbQ== X-Received: by 2002:a5d:5d0f:0:b0:488:83f7:633a with SMTP id ffacd0b85a97d-48b12736b49mr11750202f8f.28.1791102839800; Sun, 04 Oct 2026 01:33:59 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48b380f04f8sm17350793f8f.9.2026.10.04.01.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Oct 2026 01:33:59 -0700 (PDT) Date: Sun, 4 Oct 2026 09:33:57 +0100 From: David Laight To: Michal Wilczynski Cc: Sergey Senozhatsky , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Russell King , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Minchan Kim , Jens Axboe , Andrew Morton , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-s390@vger.kernel.org, linux-block@vger.kernel.org, Yann Collet , Nick Terrell , Gao Xiang , Chao Yu , Jaegeuk Kim , Herbert Xu , Phillip Lougher , Sungguk , Jaehoon Chung , Marek Szyprowski , linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, linux-crypto@vger.kernel.org Subject: Re: [PATCH RFC 1/9] lib/lz4: import upstream LZ4 sources verbatim Message-ID: <20261004093357.33a124b4@pumpkin> In-Reply-To: References: <20260925-lz4-vendor-upstream-v1-0-1c7ffbe21c4b@samsung.com> <20260925-lz4-vendor-upstream-v1-1-1c7ffbe21c4b@samsung.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-mips@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sun, 4 Oct 2026 01:50:39 +0200 Michal Wilczynski wrote: > On 9/28/26 07:19, Sergey Senozhatsky wrote: > > On (26/09/25 13:27), Michal Wilczynski wrote: > > [..] > >> +int LZ4_compress_fast_extState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) > >> +{ > >> + LZ4_stream_t_internal* const ctx = & LZ4_initStream(state, sizeof(LZ4_stream_t)) -> internal_donotuse; > >> + assert(ctx != NULL); > > > > Probably in some other places as well: > > > > LZ4_initStream() can return NULL, but the code immediately derefs > > the pointer. The assert() check seems to be misplaced, unless I'm > > missing something. > > > > I suppose those need to be decoupled. First LZ4_initStream() call and > > NULL check, then stream->internal_donotuse. > > Good catch, this assert() is a noop in the kernel (as any build without > LZ4_DEBUG), so a NULL, undersized or misaligned wrkmem oopses in > LZ4_compress_fast(), and LZ4_compress_destSize() and LZ4_resetStreamHC() > carry on with an uninitialised state. The assert() is also just a waste of code. Debugging the NULL pointer dereference is just as easy. David > > No in-tree caller hits it (all use kmalloc/vmalloc), and I listed the > alignment requirement as a behaviour change in the cover letter. Still, > the vendored files need to stay verbatim. > > So in v2 our own entry points can check alignment with a WARN_ON_ONCE() > and bail out early. It might be something that we can fix upstream as > well. > > > > > > Best regards,