From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 57A3C33D6F0 for ; Wed, 22 Jul 2026 11:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784719052; cv=none; b=ALno6YBg81FUZXEIQdYbWLF7LEtYSFy+vOBA3aVoBXiMsD4XeYz+E+BM6CkKXafFyLqUoU1CtlatfWouMIEyehOM8BQtLs0oDDuCp+j2VTI0Zx6DSnSqlglQSXG+K8hh6vwdpMC244dwTkIb3g3vKEpw61pyDkfwhx8lv6Dr/Hs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784719052; c=relaxed/simple; bh=Q1PpCWPpruAzfOkJSgkBFwdDslRdyR8xlztflKgzZos=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UAUwViwSy5g4pAwx0uIFHrXEzzE9m2Jeo6YkdfmdJSMINU8N840vXsb7ocP0yjPfriyWvx0V8rSlOD/h+il0ihISvhED43lBalWxbt3+UvKpqseZETukkbVH4cBRPGH02hao/K7nQyjN0RY0mA6KDQPAo5HuYRWI56SFRpdRpf8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=DjNUkFjV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=eZbL/BvX; arc=none smtp.client-ip=202.12.124.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="DjNUkFjV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="eZbL/BvX" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 39B561D000C4; Wed, 22 Jul 2026 07:17:29 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 22 Jul 2026 07:17:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1784719049; x=1784805449; bh=KHwAx3e0LK Xc6rgO/c/wp3wT2ZXM3eOV0Vj3JSn51Kk=; b=DjNUkFjV5JMmcQCNIkh8rzhnoo 8LtvE6jq/2vDmmkELC4DrFhjdhQr4i2CU1Hq51igWkQA/fiq6+mnwC0Qq61gM/Ba n8kFRHXh0kYlNNRP72VBDXQowjwi06bL3glJrIKwKhtxv0fQ3sG1HZ2fsqU1QmMD 4b6mEkxMNQ6pkLQBqik9IO03UWL0JdlB5mrRNlujv/DiXmM0bmx7MY3jlzA5Hj1f /Rbz/Hmnnz8SEjfSrEePWjT1n6QoK/Q6ej6wInrLgTXgpGOysMrwVv+w68y5Rihz VXC//kJU80dXJW9TtGKDAnE08kaV0eTcB5d8XzwWFrbtZ6RF7wZcDN3y6ClA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1784719049; x=1784805449; bh=KHwAx3e0LK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cK9q0P0dIf70XJkJj/6lpevVkHUPArPi7/di+clzwUsCfSPDsDF3WiQ X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Jul 2026 07:17:28 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id dee29c33 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 22 Jul 2026 11:17:25 +0000 (UTC) Date: Wed, 22 Jul 2026 13:17:20 +0200 From: Patrick Steinhardt To: Junio C Hamano Cc: git@vger.kernel.org Subject: Re: [PATCH v2 11/12] builtin/gc: fix signedness issues in ODB-related functionality Message-ID: References: <20260713-b4-pks-odb-optimize-v2-0-9c2c3ee94b38@pks.im> <20260713-b4-pks-odb-optimize-v2-11-9c2c3ee94b38@pks.im> Precedence: bulk X-Mailing-List: git@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: On Mon, Jul 13, 2026 at 09:28:02AM -0700, Junio C Hamano wrote: > Patrick Steinhardt writes: > > diff --git a/builtin/gc.c b/builtin/gc.c > > index 3207182488..8cf3781313 100644 > > --- a/builtin/gc.c > > @@ -456,7 +458,7 @@ static struct packed_git *find_base_packs(struct odb_source_files *files, > > if (e->pack->is_cruft) > > continue; > > if (limit) { > > - if (e->pack->pack_size >= limit) > > + if ((uintmax_t) e->pack->pack_size >= limit) > > Here, just like in too_many_loose_objects(), 'limit' is of type > 'unsigned long'. While it makes sense to convert both sides of > the comparison to an unsigned type, casting only the left side > to a type that differs from the right side puzzles me. > > Presumably, the other side is of type 'off_t', which is signed, > explaining the desire to cast it to an unsigned type. But I am > not sure what happens if 'off_t' is wider than 'unsigned long'. Yeah, `pack_size` is an `off_t`, which is signed. But we never populate it with a negative value, so casting it to `uintmax_t` in unnecessary. The right-hand side is already unsigned, so due to the usual arithmetic conversion rules it would be automatically promoted to `uintmax_t`, as well. Patrick