From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ADCFFCA5FEC for ; Sun, 4 Oct 2026 08:34:13 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4hyG5b5H9kz2y1Y; Sun, 04 Oct 2026 19:34:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2a00:1450:4864:30::e" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1791102851; cv=none; b=JQcCixhcfm7J/a0ylVIFoXy9UxA+6my2lHazDlH8ZrwQzO59fh4eU2iyZe46lAnpRLbD/SRZ43xJuYtLgEHxIch3Ky5/HL1AtH22BVnzoqSPcsusIDPZ6YdjW4Geuq/8TNvlFtdO89ubAVyKfoTh2U+McOtdJlgPHtmJULhfpbsah0mo3piNXRwryNtHkJQgZUqRc5fpWCPWxOEkIVHWeJpvuEEe7irNy97jcoH/quqNXrhctCYQn2xvOcWMV4BchQGutzL3QAWAgURYxOdOQWwYw9YXWhNKHSHZSP668mw+djR8Dt9EV+MzkhVcgv6UPcTmt6jqV+unP8BEdeIqFQ== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1791102851; c=relaxed/relaxed; bh=0HFDC0D77tUqEmXehAlYyAx2E0DK1wOzX1zKg1ym3bo=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZliA3/TqSIo1IBs0gx594YDvyYlAEsEaCPv5y87TssZEVwnIIBOzZefjPKZA0KxBosrDPER2VI/OvglTL+0UfthFW3fEyD+RcLeJg7EnO7D/DMO8Wlg5eMnJG0donzu4rSK/LLGhvnR0sPMmHcY8/usnf/7lt2uRc71DxsjjA7koRPLZHLOo6vACu/JW8mgvoveJoHh3M0aUivjeVTeFhKTX90a/BenmOzZ4Icol+j1W6SlkziUZuGBFrtybNdJyfuYn+mcxbIf95J0Q/B/cy7CrO4ErnQ5C+MmW81VRcW0YUx9mjpx2Swic6g5bo2OyMnxyX8gLKLQ0uvrsxO6HIQ== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=qwRS3zwT; dkim-atps=neutral; spf=pass (client-ip=2a00:1450:4864:30::e; helo=mail-wr2-x0e.google.com; envelope-from=david.laight.linux@gmail.com; receiver=lists.ozlabs.org) smtp.mailfrom=gmail.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=qwRS3zwT; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:30::e; helo=mail-wr2-x0e.google.com; envelope-from=david.laight.linux@gmail.com; receiver=lists.ozlabs.org) Received: from mail-wr2-x0e.google.com (mail-wr2-x0e.google.com [IPv6:2a00:1450:4864:30::e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4hyG5Y6Nbzz2xM9 for ; Sun, 04 Oct 2026 19:34:08 +1100 (AEDT) Received: by mail-wr2-x0e.google.com with SMTP id ffacd0b85a97d-48aff58e6abso374507f8f.3 for ; Sun, 04 Oct 2026 01:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791102840; x=1791707640; darn=lists.ozlabs.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=qwRS3zwT70HvtUmaXBWq1gXVs8Lzhy/y1kg2PhkvNh5SWmDNk+OSL2B9Tx4lncyQRl 7dWq3rOubFDTco+jn5qycA4SJLKI9poCsyrV8OzgWEIb5P3BBP2q7hXQ+TxhYutEsDW9 M4zngofdWkWKV8TjP/EuVOAY6yUyjwvsDtNgO+McV+suDGlpxCGndggUib20xntN7zEs YJyBFXtepUfqm/VfhzfAZRG8Vy+1JhTdqUh4/dXqWHcJ52uZ1m9lDPfkyEpKu4PiKBq4 irPerP/VLn6+2GE5m+ktvdfo9lDwSi5dX97OZaaEhfuyh1dF4sdCYf2gqceCLmMFn6lu BJyA== 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=IvFm3kl1WSkOGgAsFOxsf0VY+AQacJErM9mZf0Xk9vM6otGxPf+3/NdeSZvWZfQBA5 OJonfav6wZZaGjc9fzn1ckbmj29Ms2J3KQMGyT4tyfSH/agZqa/S23TC3VqfRyPx0tqK Q5sp3fAJ+nKWAn2h68zODKtz7ihVt16XhjBlpefVZwOPXpoPa1CdjklvY/mapX30B6Db ZQlgKSaJXvmDAc2Wr5mgTw6ysijKUry65D+KjM7iBDCOjRKQMgYJ1PNyiuhBRlMu49VH aMB3GWmjwxvT4qpJMveuPnnAHt2L9Ms9nvVbAKaCnWCkj+jUttoAF8Nj83qhr2EsBxPv FuTQ== X-Forwarded-Encrypted: i=1; AKwUvBy4DF15s+XWPCP1eDI21tj/KraIDkUoVDYg1N7STANcmWpABrDH5fMxez6d6CEKgvRCMKaP9Chy1HBUxw==@lists.ozlabs.org X-Gm-Message-State: AFq9FYI3Li7Cz1ooXHT9XjqVYZICK73jtXpL2v+WGwf8DChwgEZ0Gnjd 1Vlb3PpVOXzT/OtU4PClJKGf+bPoMs+QpajgOKvYx6KEvlhv0SUnwIpE X-Gm-Gg: AYBFou0qvGzvhA/TnPdPKl7jG5tpzHugsx96l0/WupjnzmMdQzxbXH96lY3XNWdMxEo 1ba1jWPIibxjMWXcKmJP1U5NplTlKUeCFfrT5qwYRgVG60S0pRIlkVBfDT9UypQe6mowxNuCh8w GMHF8IgAWZimzlerB3NIBtl6Za/PT/ZKkp1OHS/G54nvk220cGnviF/yJnyk6Cpuz99TrSvmKCE 1mktVg9UKeM741Qro1KwiN43EnCzVdRIbdT8Eb7ArNzsNseDEZvSEXlCpZTSqzlRCe/TcDTlKSu 5MxV3IoRHJS24WhSkBclb9i+8PRj/X4cuIW4Zhp6c6/n5tDxA/JjfBSKHXBeJ4RTHSspnD95xSs ZviH//8HDKxFkzJfgbVEqIfW5hg/XLoQtnbYIKTF6MTJNDPR1EPMaze+eyfWwspPnyl1IWeu0V9 g+gPyRi7ZhfE4dYob6pgstw/tk3XSJcqlZkUFCaZ8t62Ssk2NEfwFt0Lvw26QuSlR9zv6p8xuqs QTCIEDoFBkz4JDG5iGea4H8QEgXVPq2Ao9rC688ShAtzw== 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) X-Mailing-List: linux-erofs@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Subscribe: , , List-Unsubscribe: Precedence: list 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, From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D08CCA5FE6 for ; Sun, 4 Oct 2026 08:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:To:From:Date:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=W9NKit6wfjCqG3ggVnWxtk51Se9GXCSq2hvxSsYcWjw=; b=c4SRLbRO104abA3zMWo+ym4L+J YoG1a3ePW2nvfv187yBKnXACkBRciaRTeRVSs9rF6bzvV4YgetE2iSVhN9IguAylw1d1qgXRUU8bz zfzMQZGQ454zkIfwu9VpegjLICh13jqSlxMqpMPrPMjZG9f+iTcATayZc7nonjeQOxro=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1xDHfc-0007vw-Ke; Sun, 04 Oct 2026 08:34:08 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1xDHfb-0007vo-55 for linux-f2fs-devel@lists.sourceforge.net; Sun, 04 Oct 2026 08:34:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0HFDC0D77tUqEmXehAlYyAx2E0DK1wOzX1zKg1ym3bo=; b=SYNfjgHVCVCi/5rs8vfNiWQjZx 2wbB75Fqkk4AYrVtVk9YmOsJhmM62c0fImR1SqPapQiNVDRVAnSZUPcSs1exSRB0qw4UdgmTwjMnz p4Qdf22nTFJg2L8ASixWGkiD+rbrkee+nh2BhmLgsOLANNkw1ZstwiYk02Tzd5v9WGos=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0HFDC0D77tUqEmXehAlYyAx2E0DK1wOzX1zKg1ym3bo=; b=SrdpgEjht4SI59iSxYjlyUrKF6 oqoxWeVVL4oNgGGUmN3LRHlBM+z6mLnimDP2XHEMIHoAvzwPscL2iV46RVuK1MHJm93H3V0wSR6ZO m9XGAhi6RlKUO3fF1JncGqU9ZnvoJDajCNbBUq6CBNQ3u/RTpeaygpzvVNTRtXruPW1Q=; Received: from mail-wr2-f34.google.com ([74.125.225.98]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1xDHfa-0003jq-ID for linux-f2fs-devel@lists.sourceforge.net; Sun, 04 Oct 2026 08:34:07 +0000 Received: by mail-wr2-f34.google.com with SMTP id ffacd0b85a97d-48b01c41135so478577f8f.0 for ; Sun, 04 Oct 2026 01:34:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791102840; x=1791707640; darn=lists.sourceforge.net; 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=KJWOLRccsn23xKJ18+juQqRIJY3DpDaEbGlGsSKCLJdW7GA/dcMWh4rcQ/VB5+z9Ed qg3AqPI1VdAXiuZdVzDzSGmqDZV/mKpIxlq4DUG5dnfpYjWOCGWdXUrHsXOBAC7ytQRz On+DCbpl5WCv+6lAEtLf1B/H4CTpOVy4KPYAYucJbbPXqpvi+BpsOHEW7OWMEmasvPDX is5DU9e04MMvEsaR7fRFZktVSCloakKwKxFmrt6VWcouS49IZQi8HCl80p1tZY12Err5 UmiYvx2Q9gfiBIZHeFobpZgZ/+qnVoQnXZoFriQJQaFodG/KGZU1q/sGyaSiA43M29PO RVRQ== 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=HDmsklqB+EKGyDtUlytDaQYvBXq+q0h61NojW6QcfZO6fZsQ/w/zgXSYGqax+hmzdw 5jM5Awf3HaIneU+Svr9igkCkXDWmtdEbocCSdmX7bawi1lDN3QPaqzr1U2UuGWMzP5X8 XHdjJqFt2PtNOrTl82ROoPxA9vMRjrTM+Fdl+t5qlxNtsx711jJWdxfJ74YXzwi5mwlO Cf+O+tvrjEK2XMWBuDpGko5wW1QkVEPbeXTexij6eB5MKOOTzLIsQeyfh9Et2dS5N1va Ugb3GPzfisy64Xm48ojU7w7O7cECuDKOPzEH/uAHsG6GXl6SA0ajXeWYLXK2Zqmd0V1t 8CsQ== X-Forwarded-Encrypted: i=1; AKwUvBzvGDClkHwIgAOUK/JZoKMCxCbKxr8yCxwFaRASdqAhX4gbrvDMrolODruk4UJgsbGs5JZywA63/ZSFM8oueRMP@lists.sourceforge.net X-Gm-Message-State: AFq9FYI5sxnNRk6dKzJqw50yir6Nj2kMc1cwKVpfoZITkzDVbIOTxpiZ SGeift/73u9nBvrXKnE1U5q6hTBAnwY5Qbdtawq8sLUzXQH1d00O/0YE X-Gm-Gg: AYBFou3oENZq8298aMLyE7xEOfhk5eYRdCJUW9xP8qvVk9P3fW3LwVJWrc8kOAKra8d PHNm6Hy0eimzTndJ0m4RgPSnTnKhLud7YZD777rkuZrPcBn33N6f3jqvlfx8zXRppgXQLHgIdzU YbIcrXDZVJpnDFJBqYjbeMz0bF/bUVzFvtFHrC/ctrIv/pDLboQjZa/ixX11ffLT+uxSeWiAgP4 qnfcOwJ0VkjAsEQ9AIeR0cLOHv00ZF0FlrL1FkTBdDl+pdi8Azbe7ClWx6QDJOesixcbJpPAKGF IcjVAC2gRrNb2p9GvtE9yzg/7NU2cQqnAKNrFzbnZz1h1TmVXTN7wjKYEX+VtMW/j/y85LxZ3cI cgSuRbfLzx8kv8wt2k8kCQ5msvE20gk8SAyAFzxazXnBiLm2/pam1UKZ2cqgnkGYgtfBR3v1UmO 9hp/jseLblTvsJJKOnwktOAQbKI8Hq2hCGaI+GJObb6eN75N3+lSEe5ZgUQ/hkqNqMESY4uk0Pf SunV9EDvC96vyhJzObE7H1HMT8HWsl3IVOFYMUvG7ZAlg== 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 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) MIME-Version: 1.0 X-Headers-End: 1xDHfa-0003jq-ID Subject: Re: [f2fs-dev] [PATCH RFC 1/9] lib/lz4: import upstream LZ4 sources verbatim X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dave Hansen , linux-mips@vger.kernel.org, "James E.J. Bottomley" , Bill Wendling , "H. Peter Anvin" , Alexander Gordeev , Sungguk , Marek Szyprowski , linux-s390@vger.kernel.org, Herbert Xu , Sergey Senozhatsky , Helge Deller , x86@kernel.org, Russell King , Ingo Molnar , Yann Collet , Gao Xiang , Christian Borntraeger , Sven Schnelle , llvm@lists.linux.dev, Vasily Gorbik , Heiko Carstens , linux-crypto@vger.kernel.org, Nathan Chancellor , Nick Terrell , Borislav Petkov , Jaegeuk Kim , linux-arm-kernel@lists.infradead.org, Jens Axboe , linux-block@vger.kernel.org, Thomas Bogendoerfer , linux-parisc@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Minchan Kim , Thomas Gleixner , Justin Stitt , Phillip Lougher , Andrew Morton , linux-erofs@lists.ozlabs.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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, _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel