Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp43947pxu; Tue, 24 Nov 2020 18:04:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6SFtdiCnt0rdJR/MkRLgS/M7DrkF8wVyv6goY45lGXFsL6NYvD38J3eFom1yo2TwLBeQE X-Received: by 2002:a05:6402:1cb8:: with SMTP id cz24mr1399318edb.34.1606269863162; Tue, 24 Nov 2020 18:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606269863; cv=none; d=google.com; s=arc-20160816; b=n8BGMWZCzJXMvhgb8bYJN9vW9zbyIxVkTW+PFbgjVJ7C2XdOZWSmGCBQQ2mLfGhn5t oDvD14zYZR8Y63DUJCnWXU4qwNCwFKFVoSEUMRZWczLgn4msmxSxMNxdRHNSIyCu5bQo /a0P6kDvI9FLNCMyq/78SErxM06Pt3dTF/qQYy4vgJ2oZwiEDUXKyJo2DqkhtmE1BGAr 4hBs9GtanTpozfbUpITI9VP4VI/FSnapKp05JP+7EyR/25Xmjp3RGFdWaCIbAmUmtgmq Su9+OrOTso0Gw7Ff50tzMvR3OiS9owYRbkJSh6qHJVEfmhuXTleOi/IP7tfpzlnFom2P L98A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Izcp7VREgyCaRHkeOHharlEHLZvtUUoRvGQZnIJbdx0=; b=NX0FEzjPmlXzHZCw6jGJQvwy+ZlGIsscJQZ5gVLaCnnMh9p/ZBM3IPbkTlICJT85zT Ts1bgU0YtyN06pdS+rsK17/5qa+WkTnU9aynVaYUNDiw9OKOT7Y+2pJnWm9uxZR+QTlc XXedBf7td21tOPRxLEuus8JC+iKSKcq4CVIVJa07tSEw+CDX4IlKCEsLT8dgPi+LGUrr +Dtg0kxeS8mhJyeEqBebNTek6sfsIdlE2sEllU6dS/Gk3aAI38zQ0KqohucyGupXR83R 8/TgcpeyHQvfzoAqZBFeEkNG8YWs3Sle/5BtGGpg41jaHG6Mg8297TyVyUyfadcUnz/1 4qEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ubr93Bgq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j1si352387edf.417.2020.11.24.18.04.00; Tue, 24 Nov 2020 18:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ubr93Bgq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733170AbgKXL4s (ORCPT + 99 others); Tue, 24 Nov 2020 06:56:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:44246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728791AbgKXL4s (ORCPT ); Tue, 24 Nov 2020 06:56:48 -0500 Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4659A2076B; Tue, 24 Nov 2020 11:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606219007; bh=y7hNCHDhOzCdJOZUojv/G3eF5vHntYRU1MQ8NUR/VkE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Ubr93BgqQ9elnxKRaC9Uy7kW6GwLt9O4FCZNYRLejie3j/brR5HVW5ioNG+KN2IuL sUw9acNqGq7fbsqGEMgVwe2KVq/Y8+eGyRkBRIdjrTxo806Wp+dVMLh5vXOB4uozLC y6nIIF4TUE5N+aZA/krt5hTNXOMM4uegvBpiYbw4= Received: by mail-ot1-f49.google.com with SMTP id z24so5058288oto.6; Tue, 24 Nov 2020 03:56:47 -0800 (PST) X-Gm-Message-State: AOAM530rHvvpBrg2sSerYl252eTJ1Su4xRcEBrPPunAUxQhqm3TCQpES NiGo5dxS3V0RzDT+EmIcb/c07j1frO7CGbcYhrs= X-Received: by 2002:a9d:6317:: with SMTP id q23mr2756972otk.251.1606219006415; Tue, 24 Nov 2020 03:56:46 -0800 (PST) MIME-Version: 1.0 References: <20201124104030.903-1-lukas.bulwahn@gmail.com> <20201124115058.GA32060@infradead.org> In-Reply-To: <20201124115058.GA32060@infradead.org> From: Arnd Bergmann Date: Tue, 24 Nov 2020 12:56:30 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] zlib: define get_unaligned16() only when used To: Christoph Hellwig Cc: Jann Horn , Lukas Bulwahn , Andrew Morton , Arnd Bergmann , Tom Rix , Nathan Chancellor , Nick Desaulniers , clang-built-linux , kernel-janitors@vger.kernel.org, kernel list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 24, 2020 at 12:51 PM Christoph Hellwig wrote: > On Tue, Nov 24, 2020 at 12:08:40PM +0100, Jann Horn wrote: > > > Since commit acaab7335bd6 ("lib/zlib: remove outdated and incorrect > > > pre-increment optimization"), get_unaligned16() is only used when > > > !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS. > > > > > > Hence, make CC=clang W=1 warns: > > > > > > lib/zlib_inflate/inffast.c:20:1: > > > warning: unused function 'get_unaligned16' [-Wunused-function] > > > > > > Define get_unaligned16() only when it is actually used. > > > > > > Signed-off-by: Lukas Bulwahn > > > > AFAICS a nicer option would be to "#include " and > > then use "get_unaligned", which should automatically do the right > > thing everywhere and remove the need for defining get_unaligned16() > > and checking CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS entirely? > > Yes, that is the right thing to do. It's possible that this didn't work when the code was originally added: The decompressor functions are called from the compressed boot path, which is a bit limited regarding which headers it can include, at least on some architectures. I would recommend test-building this for all architectures that include ../../../../lib/decompress_inflate.c from their boot code. Arnd