Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp898265pxj; Fri, 11 Jun 2021 14:44:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQek/pEUY7DSt/QS0niDHkew5F15ladl65LXDtpzPTe4A1+FdEFzD/UwAdnLIjZg4AvLII X-Received: by 2002:a17:906:f19a:: with SMTP id gs26mr5475503ejb.551.1623447895807; Fri, 11 Jun 2021 14:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623447895; cv=none; d=google.com; s=arc-20160816; b=NvGawxuxK4fuZj4VLVkyDiQXuF+8e7OJwOLumlYfX+TASfj4h6kx08Qv8SoT6ewf8w DH7CxLUNPx3DzEo0oQmiM6LiGlTqcJhey0xAgFM95xi7js6eyWGqgFoHyGNmPT8242H1 uVoyPwYMEHVG1KgUlupegtprLIwoEgFEl0jzpLkPYd9XzgUTQvkqUtYnZ/hPy3e+ihLN qyhoE5sufm2Pfwx8TlhHulnaOlN028TWTYFx6xpjrI9DSTnXjEkawWMOIA2QVzt4REod xHxMfib1Du1MrRutqaJR7q1a5MwJ9Y4HaH5qPc+4WoSGn42TyzYBviZXkIQjPoP84yxJ qT2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=3ABviuhyW/gBVQTexifrPt1fY0Rs+xnYdvsKtcFy++I=; b=YdAdKlrsiimFKPEsrRayJdqwv4DaNT49bCEvT705X9YhKdcgxamLQM2FKR2PGcFJIO jeD156X9vN6CBeMIVXcg2wpHLvfhjmWm1Zq4FEPWAZMZ+yKJ73yEU61ocwELalHl3Bs+ amMaGnK0SDKdy3U0PhQPq6lZaIRaDVT9xX8BlJXf39jxpMFmhYndbIuLo+24e2detefn bXUDY+vcFmemO6Y56b64X2cNGSPPW3ah79R161Aw3MAakc6LcXOswuyXYO8aF2/osq/N dlLk4+Avvt3YnFzoXWEU9C9fFgcbkrsJpGaoqqxXgrK9B8JSuoTVIWI8Dpkp+Tf8d107 qilA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=TAqLpamx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o4si5118779edc.544.2021.06.11.14.44.33; Fri, 11 Jun 2021 14:44:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=TAqLpamx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230526AbhFKVmU (ORCPT + 99 others); Fri, 11 Jun 2021 17:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbhFKVmU (ORCPT ); Fri, 11 Jun 2021 17:42:20 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC1D6C0617AF for ; Fri, 11 Jun 2021 14:40:12 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id i13so38693019edb.9 for ; Fri, 11 Jun 2021 14:40:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3ABviuhyW/gBVQTexifrPt1fY0Rs+xnYdvsKtcFy++I=; b=TAqLpamx14JBvqGtI/2jQ2Eo0IVLz9IdRXTnndEV8i5Ld+uo3xauU65J+vvgL6nS72 KRk3qHuC6bvGvNZZFObgvUk97Bk7WwpnFou11vRM3gzntd2H7PcQMCPdGeeeFClVc2xM 4D+A1rIJGmpckYp1/xbzfnW4S3yv+FnFJ705Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3ABviuhyW/gBVQTexifrPt1fY0Rs+xnYdvsKtcFy++I=; b=ZS+CliszKxWW5mZXRPZehEqSc72hrLY7LFtJVY7dDebYYZXLdSrTQyOxDsBLP3/dva 0Jg/fWaXZnZubyxV8QZH9Rrt8G4NiJXLh9dIOALVWMCiprZBOKPrP4aK9s4xbj+EWc1y r5xwTKZ5vOl/77Zw/o7ETqVsjCkyYEF4GNIdzZLzIPuQ49XIWFo9M0dUHF16TV4LI/RK d/QL7rf3Ea0YtaKpSQ1YLgxJMYbSQ4GXA8RaKT4AO6MbnjZPPFh1OpUyMkC7AlcNxj3W MHOUb8PRMQMf6SIrYRXmvYsHylJAJAdL+1XWO3t4Dy8QTOWXOWEOhmVUpJ9FJHWfWf5v zHPA== X-Gm-Message-State: AOAM530Q/11akcbLh3uRPUGHZQ5ujljUw+vB8idPaIqciOsaLCGAH4fN XJBq+T6wVh6A6G8oHTnM3bJ5wg== X-Received: by 2002:aa7:cf08:: with SMTP id a8mr5735359edy.6.1623447610702; Fri, 11 Jun 2021 14:40:10 -0700 (PDT) Received: from [192.168.1.149] ([80.208.64.110]) by smtp.gmail.com with ESMTPSA id h24sm2467665ejy.35.2021.06.11.14.40.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Jun 2021 14:40:10 -0700 (PDT) Subject: Re: [PATCH RFCv3 3/3] lib/test_printf: add test cases for '%pD' To: Jia He , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Jonathan Corbet , Alexander Viro , Linus Torvalds Cc: "Peter Zijlstra (Intel)" , Eric Biggers , "Ahmed S. Darwish" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20210611155953.3010-1-justin.he@arm.com> <20210611155953.3010-4-justin.he@arm.com> From: Rasmus Villemoes Message-ID: <4fe3621f-f4a0-2a74-e831-dad9e046f392@rasmusvillemoes.dk> Date: Fri, 11 Jun 2021 23:40:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210611155953.3010-4-justin.he@arm.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/06/2021 17.59, Jia He wrote: > After the behaviour of specifier '%pD' is changed to print full path > of struct file, the related test cases are also updated. > > Given the string is prepended from the end of the buffer, the check > of "wrote beyond the nul-terminator" should be skipped. Sorry, that is far from enough justification. I should probably have split the "wrote beyond nul-terminator" check in two: One that checks whether any memory beyond the buffer given to vsnprintf() was touched (including all the padding, but possibly more for the cases where we pass a known-too-short buffer), symmetric to the "wrote before buffer" check. And then another that checks the area between the '\0' and the end of the given buffer - I suppose that it's fair game for vsnprintf to use all of that as scratch space, and for that it could be ok to add that boolean knob. Rasmus