Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4421344rwe; Tue, 30 Aug 2022 09:46:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR7PHTsriI1XvF6B1Oieb+cOb9iTxYGlaTnXU8qj5p35koDfwy9txVikEj62zQ0pAEmH91bp X-Received: by 2002:a17:902:ce12:b0:172:b8a2:d688 with SMTP id k18-20020a170902ce1200b00172b8a2d688mr21606421plg.65.1661878001197; Tue, 30 Aug 2022 09:46:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661878001; cv=none; d=google.com; s=arc-20160816; b=MF9dc+hOLPHGqIzkQFMKjrtaMBoX3QM5nHgW3UlqhaQZLeTldTfNd9tLYS+fywbc+z 3MyGOEQI4Lqd5mEBIhWMWkSxHIckYD5knHwzwsB0ETMrgrE3a7h0QRt9vOWot/TzVNec PWetTTbQHK+lF2dq8hgG6/aPdQaf3EDlXmShpbjeGDsH8g11SCh/reQ8RjXA1eZw2MPl qngd63TQnOSnbadA5Xsm9u/5EkTtR/Zb533sy8BNQWm7ZpTnWfjQ+rfha1BVV4lH1MLJ n7girbR5TjsPrmkKHX0xpAI/sSjKZnGaa8xHNTEmghnVH32CFoBSiYbuEiH/11l0zjG1 /ipA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=5Hy+KFwBBKLmtUSa078qE49L3B7yFOyDVxa6QI1pOFY=; b=lcJ9fBckJ/qhYH9egMFd6n6lgOo3jelrjeRG/QNnYA7HWc4rrzhEyWwcpzQUbto9SB TwHE7dYGVWYEbAehDert+G42MK4/yTROZxvMG3F+YI2DQu7LNHMxNn3ibVgLymFbclwX g6rNeaQUstOEzIK6lZrxLjc/A1lqL7l2S6mnkrza21jkZocyOqV/A8sQ6eya86QYrLNX 9mJW/ubk3zdo9w/KQ5esaczaSw2fxla4MRK7zShMPV/Uj4iFYkBgNCTMNg/damOC2Lns v/P6CWpNM2GITy9Qr2bFNx7AN26RgaC/SEJdV0nhsHAQynC1VH9NHI1/Yc2Jgx8od7RN FqWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=FEYouHdP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902f78d00b0016cf48bd5cfsi11911998pln.78.2022.08.30.09.46.26; Tue, 30 Aug 2022 09:46:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=FEYouHdP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbiH3Qeu (ORCPT + 99 others); Tue, 30 Aug 2022 12:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbiH3Qes (ORCPT ); Tue, 30 Aug 2022 12:34:48 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960B8B56 for ; Tue, 30 Aug 2022 09:34:46 -0700 (PDT) Date: Tue, 30 Aug 2022 12:34:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1661877285; 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=5Hy+KFwBBKLmtUSa078qE49L3B7yFOyDVxa6QI1pOFY=; b=FEYouHdP++9VpIPAWybJugu43qI+bKmM/MnmSbFITd+HDrfTankOdy8g8nigQOkSYy65GV BQlo5FtTycWMCo3kvWf/ywoN+gELKmMPq+xmAWIcFBXdtEkTs8XvCUaG19cZ4OzRmKCFvv 4kfv6SuR2A4V0p6K6s3JAgVsJ+8s70A= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Rasmus Villemoes Cc: Sergey Senozhatsky , linux-kernel@vger.kernel.org, Petr Mladek , Steven Rostedt , Andy Shevchenko Subject: Re: [PATCH 1/2] lib/test_printf.c: Add ip6 tests Message-ID: <20220830163441.q272do6lred23iqw@moria.home.lan> References: <20220830003119.1793219-1-kent.overstreet@linux.dev> <20220830003119.1793219-2-kent.overstreet@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 30, 2022 at 09:32:19AM +0200, Rasmus Villemoes wrote: > On 30/08/2022 03.47, Sergey Senozhatsky wrote: > > On (22/08/29 20:31), Kent Overstreet wrote: > >> diff --git a/lib/test_printf.c b/lib/test_printf.c > >> index 4bd15a593f..6a56dbf076 100644 > >> --- a/lib/test_printf.c > >> +++ b/lib/test_printf.c > >> @@ -18,6 +18,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> > >> #include > >> #include > >> @@ -61,6 +62,9 @@ do_test(int bufsize, const char *expect, int elen, > >> pr_warn("vsnprintf(buf, %d, \"%s\", ...) returned %d, expected %d\n", > >> bufsize, fmt, ret, elen); > >> return 1; > >> + pr_warn("vsnprintf(buf, %d, \"%s\", ...) returned %d, expected %d (%s != %s)\n", > >> + bufsize, fmt, ret, elen, test_buffer, expect); > >> + return 1; > >> } > > > > I assume you intended to replace first pr_warn() with the second one? > > Probably, but that's not ok. The test framework does not trust > vsnprintf(), especially not when it does not behave as expected. So I > very much carefully do not treat the buffer as a nul-terminated string > until I have verified that it does have a nul character (that's tested a > few lines below), and then when I compare the buffer contents can I pass > it as a %s argument. Also note how that test takes the 'we may be > testing a truncated write' into consideration, by printing the expect > string via %.*s. > > tl;dr, please just remove that hunk. Debugging code I meant to remove, whoops.