From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr2-f34.google.com (mail-wr2-f34.google.com [74.125.225.98]) (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 C67FA41443D for ; Sun, 4 Oct 2026 08:34:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791102843; cv=none; b=ARhlJPhhZ69/W7Ntiw5CCMePPLYA5bNJOe+WVID0aV47oTxg5Dko0l9167HCb0DPIHjN9WNNM8qWCKAG+vXmMjyqeEGWXOvqWDnE+jdlNplfQI/c0kwd2p3YADidlA0JcIFRSwNqShqZQ3cAKUw5DNXOQr0j/4xujMovvcwB6FE= 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.98 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-f34.google.com with SMTP id ffacd0b85a97d-48b01c41135so478579f8f.0 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=2js98izvbOJ9lSQ68ASY9NChwOxTw/imE6RcC/V+gKoeZU8naeca0N9LH2EYPtyIte cOc4PKPgN2nIE7IYHI6cjyJoEdv9FVkU8q4RnK0PGJwYI7pRyLMpiH1OeJ9HZccx/D6l iVY7PwcWTzH0UDEuNvf3bLtsF5/fdkSxgMWlmftGUkSpjmNBEW4lAFmbn2rIXSyL33Su tTbbY0uEMMOLVIYKPFoSTq6oDyOCrPTdHHIjWgOaGMIekNyijO1wqDn+WhsgurXTNGlC gBl4WNLX8YUenzIXWPCyU1B4AVxeVeirH6aeevmtzBatfpS1T151wU5ZC77c9vZZbK6C wxjw== X-Forwarded-Encrypted: i=1; AKwUvByMccu7Fpo1t/wPRNqIWAD1sLN2Qf+cT7O7wNQxci/tYavoAnILPpHnwk7+bsVb5Rxkizl1oCguszlW898=@vger.kernel.org X-Gm-Message-State: AFq9FYLxBSA9n5diUlxGvqa8Zm5jj+PDnqfd6OY9tqF6Jy821N6gsOt4 YM9xV71NfUcNApxOqsaELKeB1+pyUGgfVW4SFWjPXEA4ux540AGYXaGW X-Gm-Gg: AYBFou18VUW9TtKd8winUNylKyjo/CxN4H3gdLPHhFrJsB10Tzuvs+rGE9Q60KTSrBy ibrREKr9UXC3eIhzahUEIYgWHRd0beeIXW9HJyo4Re/iK2KaVvSEcwTo9HhtMQfDTTkDqVMtLsd WqGIXK7q2ounxuPpq/LN3HabstFAH4/9N/ZJ9T8OPWP+kD6ALyhCdoXXBW+j7xs28xTIlfiC87t ROQ0B97vsyAelqymqeoX2emX9/CQZJJF+Rj6PAJcSHgi3p/3i6zSYv5RDUheLcgola9UB8Vnvdn LDqpa4fEUlEO4MJWsM7cYnsZkDT3X64X7oVh3e2jLq0LafTDHSgO9HNe50xMvZcnk3SSs4jVnkN /EEKHAOHJelbEqVwi6q/hEo91EXXOedmjyMRajCLlThRn1cmTbLUMnfn6tG/mIkOLjrckLSXKL9 WlNY4GOPaavyQ8xI57curm7FEYAZN5rtZXwTpVegZdUzQ3gmsq+1zoPcD6+2yL0TLc1wRqkpMfT iStfx7v/SoZjZT8GDE62h3YQy7DDqeT/oR9nlHkKArRRQ== 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-parisc@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,