🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1993

Re: [PATCH v2 4/4] convert: use size_t for text statistics and ident counts

#1993
From: Elia Pinto
Date: Sat, 31 Oct 2026 10:16
50 lines
12659 bytes
On Fri, Oct 30, 2026 at 12:44:40PM +0100, Patrick Steinhardt wrote:
> > gather_stats() counts NULs, CRs, LFs, CRLFs and (non)printable
> > characters in "unsigned" fields of struct text_stat, and
> > count_ident() counts "$Id$" markers in an "int". Now that the buffer
> > sizes they work on are size_t, a large enough buffer overflows them.
>
> This sounds a bit too deterministic: it doesn't necessarily overflow
> them, but the possibility exists in theory.

Indeed, it's a theoretical possibility rather than something that
automatically happens. In v3 I've adjusted it to say "large inputs can
overflow these counters".

>
> > Unlike the previous patches, this is not specific to LLP64: "unsigned"
> > [...]
> > as needed.
>
> These paragraphs very much read like AI to me. I would appreciate a
> human touch, also to demonstrate that a human was involved between us
> and the AI that tries to understand what was done.

You're completely right. I used AI tooling to help draft that commit
message, and it definitely shows. Fair cop.

To clarify my involvement: I review the code, check the cases, run the
tests, and take full responsibility for what gets submitted. But the
wording here missed the mark. For v3 I rewrote the message myself,
keeping it much shorter, focusing on a single example (lone LFs), and
dropping the heavy-handed explanations.

>
> > Use size_t for all of them, and compute the size hint in
> > ident_to_worktree() with st_add() and st_mult(), so that it dies
> > instead of wrapping around.
>
> That's awfully specific.

Agreed, it spells out the implementation details which are already
obvious from the diff. In v3 I've simplified it to just state that the
size hint is checked for overflow.

>
> The patch itself looks good to me, thanks.

Thanks for the careful review! v3 will follow shortly in the same
thread.

Elia
Technical Details
Message-ID: <20261031101619.172770-2-gitter.spiros@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73991-linux-kernel-git=dewy.ru
References: <20261021101640.329990-1-gitter.spiros@gmail.com> <cover.1793352943.git.gitter.spiros@gmail.com> <84e9e38a3e63a2b135847471a13ea36d37bd64d4.1793352943.git.gitter.spiros@gmail.com> <auSDKKHJONZjx2LX@pks.im>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73991-linux-kernel-git=dewy.ru
From: gitter.spiros@gmail.com (Elia Pinto)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 4/4] convert: use size_t for text statistics and ident counts
Date: Sat, 31 Oct 2026 11:16:19 +0100
Organization: Usenet Network
Message-ID: <20261031101619.172770-2-gitter.spiros@gmail.com>
References: <20261021101640.329990-1-gitter.spiros@gmail.com> <cover.1793352943.git.gitter.spiros@gmail.com> <84e9e38a3e63a2b135847471a13ea36d37bd64d4.1793352943.git.gitter.spiros@gmail.com> <auSDKKHJONZjx2LX@pks.im>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2429789"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yN9XXLH+FVpsTiRRI4Go8PU/I8A= sha256:28ey1r3cJpDZ4LGMDliubJwQWPr5Z2/gu3gUb6DVZ60=
	sha1:JqPY0POgAo0WMCbE0Nl+SAbxlH0= sha256:0pUVbE7l1mr3MDV5cu0hpmYjKzA7zcZBzrS4Hyy0XP4=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id A9CE3125CB5; Sat, 31 Oct 2026 13:16:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id t479xua7R2_I;
	Sat, 31 Oct 2026 13:16:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73991-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 280BB125CB6; Sat, 31 Oct 2026 13:16:41 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 2A54429317; Sat, 31 Oct 2026 10:16:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793441788;
	b=KNMfINhYs/4Vc6Ql17XANEPKQ17oysBCtDrvDo921gXHfp9owYqE18IxZD5sYrYubbgO
	 AinXfPunAmqboybtMcp3g1XVjbIzz2gjrbdzNjP7z0GyQZ/gmtsc+8GDNTaGOkTfKM8Gv
	 T3RLQEVl5aYy3kgSizzGhesCjnxJp2AmU9Fr+YhtvvEFZJC7uT0fWWqDeU1FnsFkSJuCa
	 Edj/z6mMxCmjvIm/24doPFJNyWfHD6eYA3tAGeGBCIX2hENgcStZRvMZS9wpTKqjYjUEq
	 WIyC5sdXObU6DTegAx19RXsriUeD/a1J/IHokGybtaEZCrOfYffnEnZLtWcrMMWeBag==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793441788;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=JcmlRfqZnnY4xhXu8k/e/N8MqeuUJXimHCz+qgOi7Ug=;
	b=mLQREcK9rswbutMB0jiWQ54KiKghe38BC1OtawNcKWCIwQLvvN8OPMhMblSzSCfyFsYl
	 A6FpPbdk3ElBbZNMlS37UkDYio+k1yqv6SRliTYldQcHdGr2SN8S+YNFHZyrb9YWpBJ+P
	 qjJVI6o/MyPVZqn9sTacRlY0jWj7wvtJf3hQNCUF34f7iPTHXlvOLEZqrZZutxD4Cjwkl
	 1DLwE6CtBayWLDl6tcedxSX4vWBINrJHmXck5R7+BvnXYrhxlGydIBv6H/w+qQsF0DoGh
	 VgqkzAzQWp8kydKU+tfkWSJrnf2aAC8USe+o71xQ86E/ETucS8iDfaDw7h+CjkI/D+Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EtbLy+Cy;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E5047606A32D;
	Sat, 31 Oct 2026 10:16:27 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EtbLy+Cy
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793441787;
	b=2V1sgKiwI0UTmVkvLGsirYYfY/+UgljE6vOtRFDIW1BJCysv4724pDyHJnz8xMTu0u64
	 amT07vAXwmeHZHzy1j2u/fmUlNcrtVXoUB8TwO1faNfZh2TE0mQIAgDy4katk/AuHNgGw
	 +TAh/kLRrY1lZDX0eeqRhtV//hH6rGjsTU7w7bU3hAEaaR1Q1oHKqLRdlod7roZDKMMZw
	 1LoLgnDKj9em08RouvoCY70UVNApmc5KjppYYSjWb39b/0FkA676HmvD9JGm76xgfOgkl
	 aOxQzFYZ421yJcslh0+9SpHryvtpEjoewYat+iZzUMl0+REvPG/+oQs8EvvFB/gn0og==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793441787;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=JcmlRfqZnnY4xhXu8k/e/N8MqeuUJXimHCz+qgOi7Ug=;
	b=neZBNnFaEUkbGdDLxFxM7PPb8OaJ+zvlllFGgbT7ccxcwpRTDmyyu3Ux+4+KUly8UCSu
	 wAFTFNCe3Fe+f3egrVJS3zvi0gmhbLfkg/DSq/z3lr6HlIXv24nekvwYbP/qSed/ChBaB
	 5lFvEgdZTia7MMy3uuRDBedt44O44mI/JLPPRyO4REckRWvxGnB9Ltp05vz5VmxCHMX3U
	 LnkvhwsHGvAkrv4z86lJjI7StLuMBRoz7w2Pmxmt0yqZfgH3+AZ+xnWVpZSDwmN7+kJYC
	 +hWRs9n+8Md4T7TUNS5u6vcPW9Fp4CXNYD14IslzoNKOPGN8f8I9UyCBLcU/V78JzUw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EtbLy+Cy;
	arc=none smtp.remote-ip=209.85.128.53
X-Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2592606A31D
	for <git@vger.kernel.org>; Sat, 31 Oct 2026 10:16:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B2592606A31D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4a4d7ae1ae9so13934785e9.1
        for <git@vger.kernel.org>; Sat, 31 Oct 2026 03:16:26 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793441785; x=1794046585; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=JcmlRfqZnnY4xhXu8k/e/N8MqeuUJXimHCz+qgOi7Ug=;
        b=EtbLy+CyL0nMPVJgSgWvva8XswnI1tn6TBtiTSMNrAPh1eNiuxu4jNwhRkPRgOBWvC
         zmNqM22AbQ77ed1R1F6Fz6//ih/nADZE1v1afKEFqxPw5QBZv4/8eifnorggsREOQ4eq
         Y1U2oi3uJKGlaVQrOTB0V+XZ/LBxhFpcglYfb3PzsavpWmeZfRXsgR68Py89nB13/kjR
         ZotZnKQbvIicTEGx7C3xmlcD6MaAVMKdt/Z7LF5z72oVu7GaeSC0ySXF8qaYJVvJFsAG
         ypBcTK19f+3KMG+yES/K12Pfveny/vHZC+A6pEjUVzpsDRjPlGifUW2KybG04sBJ7Hv+
         FKsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793441785; x=1794046585;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=JcmlRfqZnnY4xhXu8k/e/N8MqeuUJXimHCz+qgOi7Ug=;
        b=G8AO7yiVBlvCkeuiCdXkwSXzhatuBcchNdgT7o5oceRhKgBe/zzlRnBLS5uoWI7fZs
         CvxhvX7D8hpgq+ZgdqD50aWtVVr74CP7OYWItjafbnhY9uBAXP8LYhPkEHQ56MrnF6RL
         JOJWBdNM26UaE/NZHefIMi7wXDKf3mEqdgm2UL9OHT2/ziUWfClMVTzXKDRfIF2AqP0Z
         /YNYalQ4QCcKs/bCEFklDNB9cq7XLaEp5l+uZYwKiVr69xdjGcKze0xMGiTJ5FQKNND7
         ZKJtRdBbC8b4mcbFMJek6IyQJMJ0neNrebicthXKWXZ8X1I9HJIyZCBXsyyduQfLhXje
         /crQ==
X-Gm-Message-State: AFq9FYJppW8Kcxvzcwx4ri2B2fgpVs2I4P8LzijaRA0DwuawjEhXgQ9J
	S1s3manHVp3uCcZez9ilIjhrUhPqHwIoNcErlKm1pwcfhftS2hD7X20m+82DPFpg
X-Gm-Gg: AYBFou0kSj3RIhfw0f5dr2x7pbUo4rVMrFEDpPghVdILDffB3Y/Ty7x9uBiHPi0+8Ht
	GP/8b84qL7Mp1spILL3yxi+Yc3lUIqX6ZuQeicJhR98QV+9ZejdKiMHXQfVqCckNl1bF6hq8swA
	gcm7L1v7HWaUpl4RVLfNh5vKV4YnYkm22HAAKnzVIgvF47S3vtW4o35jUFrjvyztAxkHgGMXwlw
	XRfLjTS9l22TqcMz40NlTFitdtChrKbUtThE+SlrcczBjWtvA0gBPuQLB1EItTzGMRMHk3tXkn+
	VAJ9f8l4gAuWBZGKpPTGG8+FnVBe8u8Yn4nipgESr89RBOjcrZNlcEuZY87dsATBb6baYr72p4H
	oZt0qd+sgI3vKdpTD5G4nFWm4h27CG1x+MzDOwgGiXgzTssU9/6GTNu2GHpFIv40Yj9Zs0btV7b
	/P/i4VFTOJ2SlWZCAZogfwxP1W3o0VfH+akwuzZaX7tDKTrvY/VKkVZZamvwrlZa4WOuHzVOFYj
	SqsalK2+V4y6+GohyeEtgO6OIUZK4mNuduM4zaBHdOB1JwQcdm6qUMk//7bsJdvFIbl92ONZyYh
	IO0Z0L0mPXvd0c1w/pG6x2MuOXFccOOa2xEJT+n6E3C+0BQPxleCj+lh2mjI5S0=
X-Received: by 2002:a05:600c:8b55:b0:4a1:f736:79f3 with SMTP id 5b1f17b1804b1-4ac17ffb30fmr107422945e9.5.1793441784866;
        Sat, 31 Oct 2026 03:16:24 -0700 (PDT)
X-Received: from ubuntu26lts1.example.com ([151.31.213.44])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4aa8213ead6sm195434335e9.14.2026.10.31.03.16.24
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sat, 31 Oct 2026 03:16:24 -0700 (PDT)
X-Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>,
	Junio C Hamano <gitster@pobox.com>,
	Ævar Arnfjörð Bjarmason <avarab@gmail.com>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <auSDKKHJONZjx2LX@pks.im>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list