Received: by 2002:ab2:f03:0:b0:1ef:ffd0:ce49 with SMTP id i3csp35223lqf; Tue, 26 Mar 2024 13:28:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV5KPeW96cIGmCkYMvppr9BXVl+ABARz3Ptbj0qvyyjDjU6JMp/XAipReujPhZtGk8k5IqSvwZiRMZo2LU1rz2ZJ5cnrr6m4HX/ARLhTw== X-Google-Smtp-Source: AGHT+IFpFKFvpZEgPWb96csbj8KNmRytezjhvqKJ0Ieyui5I3qHU6woRJBRHlboNgRYXpGgPevmh X-Received: by 2002:a05:6a21:2789:b0:1a3:2f5e:6126 with SMTP id rn9-20020a056a21278900b001a32f5e6126mr3125640pzb.22.1711484924932; Tue, 26 Mar 2024 13:28:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711484924; cv=pass; d=google.com; s=arc-20160816; b=A/HdC0B9fkdZm//sSNGiZxfFb161DPNEZMAOZx8PMDAnVciqtvCxvpO06VXZW0Zo65 LmX9E1bLtxA54EUjWLBkryYdM+uhaq7JG4Sqgjvzil+GBTRfajwQJUe/8IFtCTVURiC5 Re+Gv8k5yC3XNzu7f6bEKqG1I3e3XenTm3fwkIZ+ve7XL9ka8uEZWCeGA8yHK+nvmvTe zlVV/o3YakbG2IG4V4Ci3g7bqHil95S3v0tPGuOI4AXgBKve5eYYfqRel1xJwD/fe44T Oosck5QgxoflmIZ/nGALNjwmKIZTNNjZskEpZq8DdOM5dr6lBM3TnxwjtypLYSZ+pQMJ THtw== 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=lW5hOyGlFN+yd+Ab/TlrPz895EMMK8mpatTkc5voeUk=; fh=UXTGVHqWWW2o6FrS9K0WZfdacOKUwqoUoA+jHrWrP4A=; b=m6/sIfDQaqNLJh3M+y1Xpuc0iEtQCgX/XxIZ2waattEvjux/4yAuwx2qJAv5pEYhQ+ g8uwShCqmIleguIj0QEIHxLYL4n5bRTG4XLZAH+aW7nmGezP/11VsC2Ajb70nwZj0N9I ADf8m/E52aqhPCGvHJvxq3KFNGz5DyR9cfejYt9nYxBrmsb9h0a8BWojlcpqFgUB5Ze6 bdMsEDV9SBGB7Lwn4mGUmum1y5puwnml2vp3nx52RKtDtARw9dgpsPcTAt5UafkLkiTg kOz4fFbwVSIf/9pKfC3iBfrotZzQOfNjylks3vb2cVFAxhXHLxNAT2KVw0DoyfZqdjAj VIYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ancud.ru); spf=pass (google.com: domain of linux-kernel+bounces-119866-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119866-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 q141-20020a632a93000000b005d6d6f8cbddsi10148703pgq.360.2024.03.26.13.28.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 13:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119866-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=ancud.ru); spf=pass (google.com: domain of linux-kernel+bounces-119866-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119866-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 9810AB26B90 for ; Tue, 26 Mar 2024 20:09:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08F5313DB88; Tue, 26 Mar 2024 20:08:33 +0000 (UTC) Received: from relay164.nicmail.ru (relay164.nicmail.ru [91.189.117.8]) (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 424E113D530; Tue, 26 Mar 2024 20:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.189.117.8 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711483712; cv=none; b=SQCpjNCwfbcXyuCikenzu26u5pw9hYb8TA7GAWmso9sL/rYUZ2IqLMTZ0c/PVPxysKUGQ8USMcK212Sc6VCmPjT9g63H1DYvThYO9j+WTAG7HgQUCEBEpwIKsZoYt3F4WHZHjTLmjGCJbuWGAl7p1JckzscwvuPi1FyII7UqQk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711483712; c=relaxed/simple; bh=lW5hOyGlFN+yd+Ab/TlrPz895EMMK8mpatTkc5voeUk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lV/yDYmcIP/1IanpCXtv1q8MNGlTaG5sIw4Uzi8c0liwolEvpyeBXPWHpWprSCxEI4Fip3+Hc9JGGWm6iemNMmie/Lmw2+9ygKnvzAcI9GDALkRmWMdeJIWSWqb4hTR9YOYPhDv9vd50l0cVIq8Ond8j87nlU4DXKyJZMUqnRIM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ancud.ru; spf=pass smtp.mailfrom=ancud.ru; arc=none smtp.client-ip=91.189.117.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ancud.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ancud.ru Received: from [10.28.138.148] (port=53888 helo=[192.168.95.111]) by relay.hosting.mail.nic.ru with esmtp (Exim 5.55) (envelope-from ) id 1rpCtP-0005Dt-Fy; Tue, 26 Mar 2024 22:55:32 +0300 Received: from [87.245.155.195] (account kiryushin@ancud.ru HELO [192.168.95.111]) by incarp1101.mail.hosting.nic.ru (Exim 5.55) with id 1rpCtP-00DRyg-2r; Tue, 26 Mar 2024 22:55:31 +0300 Message-ID: <4b3e239d-ab87-4a37-ac1d-af49e1f8f3ee@ancud.ru> Date: Tue, 26 Mar 2024 22:55:29 +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] rcu-tasks: Update show_rcu_tasks_trace_gp_kthread buffer size Content-Language: en-US To: Steven Rostedt Cc: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org References: <20240326174839.487582-1-kiryushin@ancud.ru> <20240326152230.3e692d83@gandalf.local.home> From: Nikita Kiryushin In-Reply-To: <20240326152230.3e692d83@gandalf.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-MS-Exchange-Organization-SCL: -1 On 3/26/24 22:22, Steven Rostedt wrote: > Why 87? as it's not even word size, and this is on the stack. > Got 87 as maximal used buffer length (result of sprintf(buf, "N%lu h:%lu/%lu/%lu",         (unsigned long int) -1,         (unsigned long int) -1,         (unsigned long int) -1,         (unsigned long int) -1); +1 for terminator. Is word-size alignment a thing in this case? I thought that char buffers are ok to be aligned by 1? > Better yet, why not just use snprintf()? > Seems like a better idea indeed, as if fixes overflows for unpractical cases, without added overhead to common cases. The only concern is possible truncation of data, that may break some automation (if output is parsed by someone, without accounting on it being cut, who knows). But again, it is for pretty unpractical values. Will make a v2 patch with snprintf() with buffer length. Genuinely look forward to being educated about aspects of aligning array sizes, as I do not really understand the limitations. Thanks!