From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13F3DC48BE0 for ; Fri, 11 Jun 2021 21:40:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9865613CD for ; Fri, 11 Jun 2021 21:40:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230515AbhFKVmL (ORCPT ); Fri, 11 Jun 2021 17:42:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbhFKVmK (ORCPT ); Fri, 11 Jun 2021 17:42:10 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EACDC061574 for ; Fri, 11 Jun 2021 14:40:12 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id r7so24286208edv.12 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=bktWnf5JPoLDBqmrPHaXFhRnfXmo3m6Rh+df5AWWExugNfZaOU9eeh5OOrPkrfvSls MqD/8m/w+Ea8t3Nt6e8Vbye1dNX2kLJmG9gog6hsWRpjZ+WGxUDkN0kwSBfVCw3a+tmS pGIgc9Kz+ivFt+3Sue/+ZFqXXx0VhCBzRP9eqp08xeF2eTNtTwBhzpO/WWnFYGBH0XLS 8NKT/ddwgL05PkrbP4h6mb8RMXedlPNZ2vUIisFQWj7A2ff9+BuJtdmfPUQ7lb1Cr9V+ teT6Frl5jL0njZLVMjMgP8ihp/3zR8F9VxKkzg+0ol7FRjJ3z4Devw/1hMboSEgBZPL+ V2uw== X-Gm-Message-State: AOAM533chRG2Q6r4W9WwaDZn6JH9X5LDBxECe/mlb8YtsIFHnQqQZ93u Q3wzCgGqDKQ3U5FDUg422sVSplTQQARRTQ== X-Google-Smtp-Source: ABdhPJx9Fdu4hX9I8BiaTVaJb1XmF290y13+Vg8YwDR6IXWC/yvFarK1Kxyr972OcXza8etSzJ4lAQ== 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-fsdevel@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