Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1291888rdd; Wed, 10 Jan 2024 15:08:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6ML2xFOPEJT3jf33TdsqMRxGlAiYYhhncK7LZmeDv63nCHxBK00K5Pk0th4CVIqqL06Z+ X-Received: by 2002:a05:6a00:301b:b0:6d9:8e17:2ff3 with SMTP id ay27-20020a056a00301b00b006d98e172ff3mr501638pfb.32.1704928124174; Wed, 10 Jan 2024 15:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704928124; cv=none; d=google.com; s=arc-20160816; b=leOWnofYHEi+tAH4myYHHgfagbeJsM5uGoGRmiEl9+Mh9rMvX/i2fKz1zxwwX2kV0n sZ/FgW7A7Wimq9/uIN2PlOKupPN8c9YaLKPeBSJTkN3PG8Mfm+xeqaALe4IwnEE0dy/6 18TNB6BWvxo06yi7jqWYUPzIluNKK8dSqUMSgPs5GzDz23F1OCGKpsYzxDXYftZjYABF aREJ+PMNt1qfilFUnQiqaHOs1bsyLvj5UfvDBOeVBcqNd2s7vhvSiCqRIcp4F/47lPsV rg5l8Ap9/q3NFz6/nuDSl3+CPz3wqAYYIvq7PKjzx8ZED2OIqc/B0kXJWdl8eW4e1Ezv k5UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=p3Qug8q0VdY7pMyGvBvH86zD2vvdUwG2qbAIxxKPiWA=; fh=7dVqY0I5psItCKnQMK+D5XjLOOeL/PKS0dIi3Kyc3PI=; b=rTr0KKnpibykNAvl+cc9F+24+J9Kvfup5dVPSzNDVYBWgpWs8rmkxukoXnHokhSmcw qJ0+bHM9jB4dl+/iNrlKkWd8A5lAeLT/cLx8sbHFA1rKkla0s59QnLGirPZdVOHorftI 2F0TLaPE2tkZxtNi1r0FPIeBiTtxbQBysrm4TJT/cvkwVrqUEK+unfX25mXr/j8YDP4L T89lEe947QJS1cJLkVgpr5CpKizLl8er/fQQ2Q32fy7RJrmTOhCzoOyYU4p2QfDoeT1G ThDVxcgzGBWtDexPRoY2+coI6RjsFwOVdMzQFr9sVVX7Std89BuBZK+X7DEs/mejhoui 3nHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UtsmdAj0; spf=pass (google.com: domain of linux-kernel+bounces-22872-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22872-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 30-20020a63155e000000b005cdb499a9afsi4756386pgv.108.2024.01.10.15.08.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 15:08:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22872-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UtsmdAj0; spf=pass (google.com: domain of linux-kernel+bounces-22872-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22872-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 870C52897FA for ; Wed, 10 Jan 2024 23:08:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 23CE94F8A0; Wed, 10 Jan 2024 23:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UtsmdAj0" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 61E2B8F7A for ; Wed, 10 Jan 2024 23:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704928114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p3Qug8q0VdY7pMyGvBvH86zD2vvdUwG2qbAIxxKPiWA=; b=UtsmdAj0N7TFSfUX95rfkk9JHuUm00VTu74drfjx3KWj4OW+KXMeFmHySvOj8v1BEnVh7W kG0T61eIsOzUBXTfeFZyj7LKtF640B9yZgtrP1FB9z+uiXILHjr8/993+QG3fGUm7lFC9Q 68WBNj5A57icuNBQ1TG1oU2eAS1xgNk= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-5-W6OkS7MGe8fNKVTH-7pw-1; Wed, 10 Jan 2024 18:08:27 -0500 X-MC-Unique: 5-W6OkS7MGe8fNKVTH-7pw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-78319f5d6edso607860385a.2 for ; Wed, 10 Jan 2024 15:08:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704928106; x=1705532906; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=p3Qug8q0VdY7pMyGvBvH86zD2vvdUwG2qbAIxxKPiWA=; b=RoyB6hY7paXlS8nmhogpY0j6s4stmC7lf49ckdlK1Ok+6h8CEewA5uUK1H4T1Qzq/a vjMuNtd30a7DdVvvzeqcA2yoi2Jhs4m+bWbGXnTU/d97UP5EFwBAFWL85GfFTBbZDLs3 fEQF6dgwbCfBr7GnV8pg1Ww3SeqpTanwVL4yMVc4Z03ExUN0v+aklUrE8cIwxJR5eLMY PEPUbR+RzlB1MRI2fI40G4TbS6xFIjiWiwMI8nfl3IXeXowr+l2DG+WUTMRE4VliGwkx FZcRbFXK92QCQpEWdtuVtM1NvkVm9yXKik/F2HtRoiRzjMX96zEAjFyzrPREuFI2QR5O d/Kg== X-Gm-Message-State: AOJu0YwW7pZ4E0g9xBO4bRZR078sNqgXSyP2ZR0kCrA5emwKTiwZoT8d iFaf+UQaqXsCqEkFM3870WxXYuf1FLwon3L+1Q+iIRkbCrge4Xq3VSDOMNDjrMYpHYvE4mHQD1/ A9/na7BG8FTpWK7oTS1TtOGP8EoTbJids X-Received: by 2002:a37:e115:0:b0:783:3063:14cf with SMTP id c21-20020a37e115000000b00783306314cfmr383104qkm.27.1704928106731; Wed, 10 Jan 2024 15:08:26 -0800 (PST) X-Received: by 2002:a37:e115:0:b0:783:3063:14cf with SMTP id c21-20020a37e115000000b00783306314cfmr383092qkm.27.1704928106481; Wed, 10 Jan 2024 15:08:26 -0800 (PST) Received: from optiplex-fbsd ([76.152.42.226]) by smtp.gmail.com with ESMTPSA id w2-20020a05620a094200b0077dd463da60sm1940682qkw.126.2024.01.10.15.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 15:08:26 -0800 (PST) Date: Wed, 10 Jan 2024 18:08:23 -0500 From: Rafael Aquini To: Rasmus Villemoes Cc: Audra Mitchell , linux-kernel@vger.kernel.org, tj@kernel.org, jiangshanlai@gmail.com, hirokazu.yamauchi.hk@hitachi.com, ddouwsma@redhat.com, loberman@redhat.com, raquini@redhat.com Subject: Re: [PATCH v2] workqueue.c: Increase workqueue name length Message-ID: References: <20231215193954.1785069-1-audra@redhat.com> <20240110202959.249296-1-audra@redhat.com> <2f0efed5-f9f3-4a5c-9fd4-a4837cada298@prevas.dk> Precedence: bulk X-Mailing-List: linux-kernel@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 Wed, Jan 10, 2024 at 11:52:38PM +0100, Rasmus Villemoes wrote: > On 10/01/2024 23.31, Rafael Aquini wrote: > > On Wed, Jan 10, 2024 at 11:06:22PM +0100, Rasmus Villemoes wrote: > >> On 10/01/2024 22.52, Rafael Aquini wrote: > > >>> The extra vsnprintf call is required because the return of the existing > >>> vsnprintf() is going to be already capped by sizeof(wq->name). > >> > >> No, it is not. vsnprintf() returns the length of the would-be-created > >> string if the buffer was big enough. That is independent of whether one > >> does a dummy NULL,0 call or just calls it with a real, but possibly too > >> small, buffer. > >> > >> This is true for userspace (as required by posix) as well as the kernel > >> implementation of vsnprintf(). What makes you think otherwise? > >> > > > > this snippet from PRINTF(3) man page > > > > RETURN VALUE > > Upon successful return, these functions return the number of characters > > printed (excluding the null byte used to end output to strings). > > > > Assuming we have the same man pages installed, try reading the very next > paragraph: > > The functions snprintf() and vsnprintf() do not write more than size > bytes (including the terminating null byte ('\0')). If the output was > truncated due to this limit, then the return value is the number of > characters (excluding the terminating null byte) which would have been > written to the final string if enough space had been available. Thus, > a return value of size or more means that the output was truncated. > > How else would you even expect the vsnprintf(NULL, 0, ...) thing to work? > OK, that's my bad! Sorry for the noise. -- Rafael