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 53E6B2E62B7 for ; Wed, 10 Jun 2026 23:48:00 +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=1781135282; cv=none; b=epgjIbFAnGwwi8w97IL1Jxq0V2GX6WV0lyrXyED4VD9nxyUeWFCWtn1sXH8+6KC488vm9taJuIhhqxnmYie3R8JjzQskbIygkBbhtC2mHThVAnX+mSTJQl7PZgUJoWQwiIF8HXzS6LN8L+/2Qy2HPKlorvpSsrB6bNCV2L8zdj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781135282; c=relaxed/simple; bh=7C8PSRNtmNdiNl0OjeOgBVBnQ+5Xa2M1zY0oxgvRxng=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=pgYHcrBRvdclOgAXRDZ+iEkdSJFc1VWsqajcAhP6nZAoiO5ww8eQjO1Vr6wUEpCGV0mfGcj5V+4QPVXsobPKizaXg7zxgvYJbK4LNqHISfPgLP/unJJxdD5R7PPdiwVyU8lR4qK3Sj8dZtSQmqeG/twYs8D1AHQZwMevNWQXfxE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=QYbfPlmM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="QYbfPlmM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3D371F00893; Wed, 10 Jun 2026 23:48:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1781135280; bh=VRuRMloW4IZbUdaynF5PvOosgrEAB3LSb/l5RKiVRBs=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=QYbfPlmMfVWvCyr6rzT8wlU0LSg/tNfW8hWTCCVeeiJ2P0yAb0lBCyeB+PS9jVC+S wZALJykhEtcI35rR77mloPMPmqG3HDwSdVgW7oeDXtwTj42SPdtglTekJl3rlXEg/S L4rze8hoXaPcP74N3YKGxP0XCN/myiA+mZ0dmT4k= Date: Wed, 10 Jun 2026 16:48:00 -0700 From: Andrew Morton To: Nathan Chancellor Cc: Lasse Collin , Thorsten Blum , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib/xz: replace min_t with min Message-Id: <20260610164800.d0455e4da25f7101e382ee3a@linux-foundation.org> In-Reply-To: <20260610232323.GA1071374@ax162> References: <20260609150030.634570-1-lasse.collin@tukaani.org> <20260610232323.GA1071374@ax162> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Wed, 10 Jun 2026 16:23:23 -0700 Nathan Chancellor wrote: > 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."): Well that's annoying. A pleasing solution would be to make the xz code be more consistent in its type usage. struct lzma_dec has a liking for uintXX_t whereas struct dictionary likes size_t. Perhaps a fundamental reexamination of what these fields are representing is in order?