Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp104289rdb; Wed, 14 Feb 2024 14:19:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOTZHPA+7VJ/3KtV8PsFLh/We6S5bZigYSZgIeNijMR7SHYNDbp9rQeIUxB8Ilr07i8gHXqyKFXpW6tmlVmoklJw1UY+Mt8cY8fY1btg== X-Google-Smtp-Source: AGHT+IEHpt8Vgj4eWIYplfjZfFwMFcggFioZBeEvwukJbTgDPc1YRIA+cNpdsuVcW3lrI1VUx+2P X-Received: by 2002:a17:90a:17a2:b0:296:7b91:7c9b with SMTP id q31-20020a17090a17a200b002967b917c9bmr43758pja.46.1707949164641; Wed, 14 Feb 2024 14:19:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707949164; cv=pass; d=google.com; s=arc-20160816; b=zqLHZyvceDr8IKB7eu2CM9wVDJdE1KRC3vALvgvR7pSdaHt5Mv9qiPNna7LzHvqql/ haPsv3H3XzEcK3W/ght1KWkJ5RuqrR9Fy/vbx9CmVgJjqdAspuxwV1CHyqkvuLy/dvbk WFT/I7fBkgEnofnpF95kN9NWdaX9ORvoeXF+2O8uPgsDS9mUOqG33YDS/yngoor5JOXF R0BycCgfjRJbejxyIKd/oPwijC73QzBXUvINZiRh9c8nd+2AUKOtm7LXD+Tx0oWvzcZB Q/7AiUknhMc36ESHazAvtLoIJiGtC0+M04dftjy+tw/xkAd+sGaV/HZiCWcMZZFL3ysZ arGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=rglWK6WubNcE0y4AzULSNhV+yCVOFPzLOZ9p+bvdlCI=; fh=zjz33CCTaPrY8zWVY2+3Jf+oD43vxBNRVXUPx1CCdyQ=; b=Iye2NKp4t2xSfptmD2WAV2+sg9cd745oOAK9JPgLGKRoEOar8b8nUul0z2hvlICMUJ J7q8nvbCKBiIlds1UZ3mrxK0VJXxqam0FoGokSlpgcveQW9G3oyQ1Bhc+47VMTldTdfn 6JGYySHcSQxn5GjS7f9ImDMEN6xZAX2n8/Q82WXC5K1jj4HJYqa6MX9Ot3ut/WNJsLTJ ncXH1GqiFj5c6cEWuEnGfFvx/NzQC4vbMKJKdmeevS0QWfrSNpUuANGBgoCnP2F6OH90 HP0AJOhNIBjImP+CI9zMqmzrBC8rsNHwZBYC9TW28ghjdJ+JV/43eDSKFNtdoUnU3/+U gm0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sdfg.com.ar); spf=pass (google.com: domain of linux-kernel+bounces-66019-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66019-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s1-20020a17090aad8100b00298dda0d1casi1445581pjq.85.2024.02.14.14.19.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 14:19:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66019-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sdfg.com.ar); spf=pass (google.com: domain of linux-kernel+bounces-66019-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66019-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B1DDB2280E for ; Wed, 14 Feb 2024 22:03:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 778C814198A; Wed, 14 Feb 2024 22:03:19 +0000 (UTC) Received: from alerce.blitiri.com.ar (alerce.blitiri.com.ar [49.12.208.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0995141987 for ; Wed, 14 Feb 2024 22:03:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=49.12.208.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707948198; cv=none; b=tx8iXmNj8zYCkJO94BY49IaqnP+3pEAM1QIihWWoD8fwvOy376nQYaZYNcBwOXfDa0h62dj0tbjWBkjRiassxBfzgCmKWUaA2F6UXJHplVynhWFacCD2RSglfZNSJIJGao+yxPFOx/W/zrj+UeTOrjN06y+jlhiyg1riUv+yBkk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707948198; c=relaxed/simple; bh=bm+DDeD+3WZc10UE4ly/LZAYH80yyDouR+N9Lw06dKE=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=c/jjwom0irt+xVAuV6YqfnMhoAy9EuD1Fqm1dc7/OqCAdfvFQVoNu9JSlaMB8RewJcpwyzIPdmd9UfSKXksfI6T8+95euLniEbou+CnHC5FNIteNxKN+00Zs1aUsaQ0Y1KyDT/FUEcF6EZ0e8nMqFvhPG5U3SGH2woTdzirMBmE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sdfg.com.ar; spf=pass smtp.mailfrom=sdfg.com.ar; arc=none smtp.client-ip=49.12.208.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sdfg.com.ar Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sdfg.com.ar Received: from [192.168.0.26] by sdfg.com.ar (chasquid) with ESMTPSA tls TLS_AES_128_GCM_SHA256 (over submission+TLS, TLS-1.3, envelope from "rodrigo@sdfg.com.ar") ; Wed, 14 Feb 2024 22:03:13 +0000 Message-ID: <197c0910-f1e5-4e55-81a3-59cb2069a1d7@sdfg.com.ar> Date: Wed, 14 Feb 2024 19:03:10 -0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/4] tools/nolibc: Fix strlcat() return code and size usage Content-Language: en-US From: Rodrigo Campos To: Willy Tarreau Cc: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , linux-kernel@vger.kernel.org References: <20240129141516.198636-1-rodrigo@sdfg.com.ar> <20240129141516.198636-3-rodrigo@sdfg.com.ar> <20240211104817.GA19364@1wt.eu> <10b97cd3-5690-40b2-aa8e-3fea5dd4275f@sdfg.com.ar> In-Reply-To: <10b97cd3-5690-40b2-aa8e-3fea5dd4275f@sdfg.com.ar> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/14/24 16:34, Rodrigo Campos wrote: > size_t strlcat_rata(char *dst, const char *src, size_t size) > { >         const char *orig_src = src; >         size_t len = 0; >         for (;len < size; len++) { >                 if (dst[len] == '\0') >                         break; >         } If you think about it, this is strnlen() and what follows is strncat(). > size_t strlcat_willy_fixed(char *dst, const char *src, size_t size) > { >         const char *orig_src = src; >         size_t len = strlen(dst); >         if (size < len) >                 len = size; Same here. We can simplify the code by using them, but the size doesn't seem to be smaller. Let me see what I can do.