From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE2D7299A82 for ; Wed, 10 Jun 2026 23:23:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781133808; cv=none; b=YFL/uLJOvMcBIbprx9iQRKuXb9l7wMhFIvFtX5xlSCfghXBGdZUziZWgqs4gjVekjx66kw/eAgiJJsIyE2aNsyBBD449GBrjxzVfWY6xej2gK+/xRBwGwCnhcooH1ubbeYrgWppuJ2irqOUWw9c+cqE/yC/1XL4y98QQkJTHoh8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781133808; c=relaxed/simple; bh=5ZDPy2zXFL/Ow60OxLGBiFSFywqf0btpOQHxk98o24U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NQr6YxL7Zx9UvAgAsK4J115wXW1eNShmyjrKn5sFNQRTIK/SBDWloBXD4DI5ru1NBvAlWv13kMHF3L/Q5QAmmQllMBDCs3AOy5VJdZSvTkfUJGE/ikGwWvTRXziz2Su/jRDcC4uaRylGXNECC93rfOLForoDctQ21hiCg8QRdlE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gZ4wKA11; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gZ4wKA11" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B43C1F00893; Wed, 10 Jun 2026 23:23:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1781133807; bh=BGIeR6MUk7+arAjuJ+rrZDXC6cTyQ9x5Ozwbgcr/3JI=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=gZ4wKA11iiLiEEdwaDiLWIrICtNv7myyj1nmxGiDB0bHGmaXprzYebPn+NZAWuORv xAma5RepG8Rrfn4y+/heH9Eulo465W6hxYd6M0X+7B2cnNIb1HHgnQcV3VywvTNxUM F9R5Si1BGlBCN/ArG151PbTtXUXSsEP5tVFkVT0aHzobEHB+fytzUMoUr1ufqUc86h AejlgLGpr/DtF2+wi4uplRN0UaeVHg8sLp6poMtyt6u17za+li3yDxr2w/4KPHsXf/ +lbfNIicub39RhjOzFsvijaHzJLUEvLJpMad6b1/1J6S3PnjbDlY9ZYd0njIQrF5+U IvrpgCmralO4Q== Date: Wed, 10 Jun 2026 16:23:23 -0700 From: Nathan Chancellor To: Lasse Collin , Thorsten Blum Cc: Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib/xz: replace min_t with min Message-ID: <20260610232323.GA1071374@ax162> References: <20260609150030.634570-1-lasse.collin@tukaani.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260609150030.634570-1-lasse.collin@tukaani.org> On Tue, Jun 09, 2026 at 06:00:28PM +0300, Lasse Collin wrote: > From: Thorsten Blum > > Use the simpler min() macro since the values are unsigned and > compatible. > > Signed-off-by: Thorsten Blum > Reviewed-by: Lasse Collin > Signed-off-by: Lasse Collin ... > diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c > index 4b783ac94e71..9d80342b9c6b 100644 > --- a/lib/xz/xz_dec_lzma2.c > +++ b/lib/xz/xz_dec_lzma2.c > @@ -354,7 +354,7 @@ static bool dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist) > if (dist >= dict->full || dist >= dict->size) > return false; > > - left = min_t(size_t, dict->limit - dict->pos, *len); > + left = min(dict->limit - dict->pos, *len); > *len -= left; > > back = dict->pos - dist - 1; > @@ -1098,9 +1098,8 @@ enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, struct xz_buf *b) > * the output buffer yet, we may run this loop > * multiple times without changing s->lzma2.sequence. > */ > - dict_limit(&s->dict, min_t(size_t, > - b->out_size - b->out_pos, > - s->lzma2.uncompressed)); > + dict_limit(&s->dict, min(b->out_size - b->out_pos, > + s->lzma2.uncompressed)); > if (!lzma2_lzma(s, b)) > return XZ_DATA_ERROR; > These two hunks from this change in -next as 1003161e12ac ("lib/xz: replace min_t with min") cause warnings in the arch/powerpc/boot code, as it uses an old, simple version of min() and max() that does not have the improvements done in d03eba99f5bf ("minmax: allow min()/max()/clamp() if the arguments have the same signedness."): In file included from arch/powerpc/boot/ops.h:13, from arch/powerpc/boot/decompress.c:12: arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c: In function 'dict_repeat': arch/powerpc/boot/types.h:31:21: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types] 31 | (void) (&_x == &_y); \ | ^~ arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:357:16: note: in expansion of macro 'min' 357 | left = min(dict->limit - dict->pos, *len); | ^~~ arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c: In function 'xz_dec_lzma2_run': arch/powerpc/boot/types.h:31:21: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types] 31 | (void) (&_x == &_y); \ | ^~ arch/powerpc/boot/../../../lib/xz/xz_dec_lzma2.c:1101:46: note: in expansion of macro 'min' 1101 | dict_limit(&s->dict, min(b->out_size - b->out_pos, | ^~~ We could try to update arch/powerpc/boot/types.h with the current min() and max() versions but that will require dragging in many other macros. Could try to make the Linux headers work as is to reduce duplication but that is likely quite involved (and maybe even undesirable). Backing out of these two changes is likely a better solution, at least for now. -- Cheers, Nathan