Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp785151rdb; Sun, 18 Feb 2024 11:34:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKd36rHQRjCSZIEmKbWIc35LDLlDrdRLiE559lSPtXtXKa830VBJ+cyeDCBxs4jxzsAJZI+WiMuST6qZY9bFee7Av0wvVJw8pl4V7e7Q== X-Google-Smtp-Source: AGHT+IEsS9Rpi15cRLIO3LlLQrfqX2alzWpj6kcdf3CJDIfX6Jf0+Jr1AJaSsMlZaZ5ttXEf2lSc X-Received: by 2002:a05:6870:b6a0:b0:21e:e24e:e7d with SMTP id cy32-20020a056870b6a000b0021ee24e0e7dmr140182oab.7.1708284859538; Sun, 18 Feb 2024 11:34:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708284859; cv=pass; d=google.com; s=arc-20160816; b=BBexsi2S47YNH4/oUv+NtSX1136SlMfqXQT3x27OiLSNC1DWpKwT3in2aYpTJnbJL4 hoJXu1rgKW3yG6XGlLoWhHGlZfxY5XNwgU1DqkXf+eg6hldO/lESTue/MXmdT/6mn9e+ GIjYHgxxN5EW9fYmkWeHhGXl8aUbkflfW4RKskCvzRTBZ1MXLi0pp3UpCtzYM/LsURDl S0CqyvVkHZiK1yZshm8TvL73tpamdBJ+YAggBXR61ryCXqdC7m2O7zPyrjb7KqUbh9ys kavVftRrq7uMThlwsSaC0QpFeWSIn/ATlm/WnbASVoqVBbncGKvkSEPqBUhza0rS294S mytw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=WoVOpWaSWh/1eLa3FKwNz0/DZJeJyAK4oxVeDAen1EA=; fh=zjz33CCTaPrY8zWVY2+3Jf+oD43vxBNRVXUPx1CCdyQ=; b=rerYwWgy7m+oIU/GATYR2BmBPZtCEbOffviMDlo3lJH+QajTXDPLW6RaX8U6gjroHG DuIrb8ioUyDxgUO2v/NBftWEhskEV9XJ+MT43j6Zeby+PdmQcgqSzyDzkFNJTQvwtzrA VOFRNr+h9hR6g03b/ftOidOlYyWQUyUEVSU5dz0ByHJSXzEuu2Y08IaacOUL2gVUYhm9 hHqlpnfL4ucXoGpq43jIq39/G2GHUBSX80ixtaCeQeB3AMRMf5Q2lssevl7p0QTvW2VR AFQk9NIGndOo8Ve1emDcaTJ37DRy5Lzx1pdllBr+ZJEoIv+VK167YsY10nvuMV6l+hZy MrAw==; 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-70551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70551-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id po4-20020a05620a384400b007872b69151dsi4558793qkn.170.2024.02.18.11.34.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:34:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sdfg.com.ar); spf=pass (google.com: domain of linux-kernel+bounces-70551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70551-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 498991C20F92 for ; Sun, 18 Feb 2024 19:34:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AF0371B2F; Sun, 18 Feb 2024 19:34:14 +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 83C6F1E86F for ; Sun, 18 Feb 2024 19:34:09 +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=1708284854; cv=none; b=nDwYsrXjBy4hZghpCPXyMGMpq5aw3HWRgc44216oBQBOwg2z5K+1BBAq9dOwL23DZhx4zM+2AnpIP2XhTAUsMKoP2w3SWQdvkOg1dLaaEJMIQNcuItjRvZG70MruLAo+qwXH6xOHmrm7EndenZ6C/77Vqd+uzDTfmCw6/ExlB4w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708284854; c=relaxed/simple; bh=Yj9qMMPZ19LtDe2elg6koYFa60SHjf7b/xK1dI0ZI5s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rXWaT5C6KqczdT2hoGZhiEU+vGgMcqaY/41Akf8A81JTUujCLnuBZIw01etx0yuuk5e12bmHb8+wn2o7eYL6Qi8eLgd4OEeGURUP3fPsTK763yB7Eu+wIEgqE4fBqu5P/oCZjqOuZ5lz+ClGpUPO1CceQ4Iciln1RjC+8nJQdSE= 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") ; Sun, 18 Feb 2024 19:34:01 +0000 Message-ID: <428e1561-3219-4567-90df-7130013f3468@sdfg.com.ar> Date: Sun, 18 Feb 2024 16:33:59 -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 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> <20240218102003.GA32375@1wt.eu> From: Rodrigo Campos In-Reply-To: <20240218102003.GA32375@1wt.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2/18/24 07:20, Willy Tarreau wrote: > Hi Rodrigo, > > > OK this looks good to me. I'll use that version in the next send then, thanks! > I think your test on src != orig_src is not > trivial and that testing instead if (len < size) would be better, and > possibly even shorter. Fixed that, thanks. >> Note the "if size < len, then len=size", I couldn't get rid of it because we >> need to account for the smaller size of dst if we don't get passed it for >> the return code. > > Please no, again as I mentioned earlier, it's wrong to use strlen(dst) in > this case: the only situation where we'd accept size < len is if dst is > already not zero-terminated, which means that strlen() cannot be used, or > you'd need strnlen() for that, I'm just seeing that we have it, I thought > we didn't. Right, sorry. >> What do you think? Can you make them shorter? > > I don't want to enter that activity again this week-end ;-) It's sufficient > here. haha, fair :) >> If you like one of these, I can repost with the improved tests too. > > Yeah please check the few points above for your version, make sure to > clean it up according to the kernel's coding style (empty line after > variable declaration, */ on the next line for the multi-line comment > etc) and that's fine. Will do Best, Rodrigo