Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2358258rdb; Wed, 21 Feb 2024 05:27:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXBpU3ijlr4v6F3Jiu0Ytxj/EjWmZrHK81qf0KP0df2xGarddWf8WfpnyKw6wegejmS6qflTAG5uHINgQPW7wM+ReoJokIQZHjPQ+rI9Q== X-Google-Smtp-Source: AGHT+IGYpkmG86AKDbUgS0jyD0KfwmYICIffTQdbrNdXtfE/Lhcc8v6k5kqUtk6xdY7/F53lPQpT X-Received: by 2002:a05:6808:b0b:b0:3c0:2bf5:7c11 with SMTP id s11-20020a0568080b0b00b003c02bf57c11mr18647772oij.17.1708522059337; Wed, 21 Feb 2024 05:27:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708522059; cv=pass; d=google.com; s=arc-20160816; b=epB/QeQ2X03YUdN68+/np5CByTmtA6+bCj4P854tDUnO6UANlWgRlzE5bTAu8eBtOM bEozafy70MD0+qXfN12loqMHuXju9E+9Lpf5Hz9KimAZ2xbWIhCdmFmdMPdvlqM2Awxz CcY1eXFl4WGvUYQ0Kue6CPyN6iaJFgxDWESjYmCj8eZ5kerxuLDkncLfY8TqzXnDr4g/ c9q6R10C4kJf2qE+GHnsBM+T1nyD2Qr+irXJEYv4m8W+HImFYan0pEfobYkdAyhmnXlE B6GcNT2x7jNYP8FWyetkSbayLijcYtJwd/8Skku4/A4JFaMuu86hvAIX2YZpXWi/Ss+V TkPQ== ARC-Message-Signature: i=2; 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:sender:dkim-signature; bh=yZxuMWu2/GCsqoFcXfd08+HFIieM/pOcLCTfMALNvWA=; fh=u2fBtkvYJ2V8kVvVFEf5N3zn8+2mVvl+0mEXld9aD+A=; b=edR11U4Uds6pW90HKDZ4wdpXm8otwmEGYZfGzKlcvnazc5AEMnXyysIfzlKl18/i0d Pg9hYPkxvYEC+VqA9OFvBS1CKxuZBLObxclUYQV6rCIVBr/6SJmeicTDXa/FLMpuveu1 4lBdYZN+6J3wUkZqt+Ai6mgZykWFJ1LWghLS2j/w5pgqTroeq0GSq6MC55x+6H88gk1U b8PDoWTx+BFxUfrAqVETgxiCwQUEmB9Fsp5uuFd3/ozXepMFSPuKNBspBfHbgI/ZTl7o tBSuYVRjkxcXbUN2N35yU6xC+QJNJiBxFd0a6HKM1+LiGi2Vb3yLzKQRlmTCJVg3Wjj8 P0mA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LUqK+Beg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74790-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d3-20020ac85ac3000000b0042c572ba1efsi11602977qtd.559.2024.02.21.05.27.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:27:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LUqK+Beg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74790-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0D16B1C22EB4 for ; Wed, 21 Feb 2024 13:27:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC1177EF0D; Wed, 21 Feb 2024 13:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LUqK+Beg" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5272F762C1; Wed, 21 Feb 2024 13:25:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521941; cv=none; b=ovYDhk7FZOKYNSMaZh6T/xy3kJCPuoet2ieEp5GOsTiPajgVZPb7a3aPQ26vopEo5Pi0PcolH07kZTZ1KwLJlaDuaBSNOs3aNd3frOEEesVALpFwhvVmKSXrATrGxnOXu+CRQP2r4rbvukdQ2+J2Uca3AF8XgJfigzJ9aLr2G+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708521941; c=relaxed/simple; bh=AxOQfD/dYnKPjkTN8+5+25Conjab7Jj8Z4WrkBqpxfU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OqQuwKEAzkp4BiEqpJpeI06DjCyzPNmKS/GYZp8dN+UpkT9m+ocU0NnXnpo9z2bPWWj3eei0PHvvbBCljAO0F0ipzlWlBQEkrnZYOSYJ6pPrGjSsryXzyFmCHPzKSM24W0XIyc5ORheIt+8I9yrzWOEHxNaZGL8aiHq5AoGBqV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LUqK+Beg; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1dc1ff3ba1aso13323125ad.3; Wed, 21 Feb 2024 05:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708521939; x=1709126739; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=yZxuMWu2/GCsqoFcXfd08+HFIieM/pOcLCTfMALNvWA=; b=LUqK+BegDwPf+diWj48G8UWsXY6HmRgLa1zURC9c+1kKcp2klOZrXE4IrZSo6F1tnA 64urjXlF7Fv9tXEXiA60APyLGPfcyGxeBURhWUi67mKg+1xnAIiy41nV2B/1DVwEMmJZ MtetRbmkGebQ5NPuS1aLjnX28W7xUvI96KGWAzQIVc3BpRIUIDTYdZWmn8J+fjYBmh7i GFYWmn9oRypBTyAB8pEp0tS/NyR0rmN02id5KvgwN/EFA7fg07I7h/Gzf5FvRij1ue3p r+eZoPJSUsSzqyj0H1lC3CQSbOew+dLV+duUOGiL+ZAG5U/1rbLEtLQ8TXVpmdXyAf5g 6MfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708521939; x=1709126739; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yZxuMWu2/GCsqoFcXfd08+HFIieM/pOcLCTfMALNvWA=; b=JrcWvGZNPS1ZgoFRlQOxf5DGV36Ko5MlfMialBPAR7cWVzFoqx803Ydo1s4AbkWbG1 C4xwLchvm0bODcGlKA1JLsB53CesXAGQBJGhXJoPIDMtj9E2kZvF6juvMUut7TvXoIPw qiG+ocOZSp1GL/S18pM2J6jHNhIRwS0v8W2Abwa1b296BaC1ZDgWM5x129+HWuW7H8YQ zZd5fgFCpwwSnruA+UtPgE0YElT6LKuRloKPtfWXXFXC+YnPBpUEBVr5fsU5IegFJP2w OBbsBF4tiOIjse8TYiGu/S4e6XFr8NC8Aeo/RLj7mg6sWkQCMq6SFysR7TwjPQlHBeM8 7OEQ== X-Forwarded-Encrypted: i=1; AJvYcCUdqFgGMZO8OnLTkypKyKH+qJ/V7AErn/mMpAuZ3UAzKFm/fvEUaj8zN1ABAbUp+RFdxBDGj3UX45BimkcJppQW5MKvcN5Y0McQSufRb2gGL4mt8LAzH8ZcEHMrGdcoi45NFO3XIzWl2ccLpu2IlUNx0qVnHvMiMVooSdG5eXi1jliwG+8HS2Wal/eEdo4IieX9b7QKjyoXzM38wi5YsNTLxZEY/h3Q/411+ToO8yvUl2FGDi3XFdezsU7k5QlMKIlt X-Gm-Message-State: AOJu0Yx6HZzHlxOFPm+tVrlRkU8W9hAYfRr4rNtqveT0udYCsjy/68Wh AjyPb1EztP7bNpYS0IawOAOnD2i42jGrgNBg9ycKAgoywSN36yXx X-Received: by 2002:a17:903:40cd:b0:1dc:24f8:61b7 with SMTP id t13-20020a17090340cd00b001dc24f861b7mr4170590pld.67.1708521939524; Wed, 21 Feb 2024 05:25:39 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id iw11-20020a170903044b00b001db5e807cd2sm8020061plb.82.2024.02.21.05.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 05:25:39 -0800 (PST) Sender: Guenter Roeck Date: Wed, 21 Feb 2024 05:25:38 -0800 From: Guenter Roeck To: David Gow Cc: Linus Torvalds , Shuah Khan , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , Christian =?iso-8859-1?Q?K=F6nig?= , Kees Cook , =?iso-8859-1?Q?Ma=EDra?= Canal , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo , Brendan Higgins , Daniel Latypov , Stephen Boyd , David Airlie , Maxime Ripard , "David S . Miller" , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-xe@lists.freedesktop.org, linux-rtc@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-hardening@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH 2/9] lib/cmdline: Fix an invalid format specifier in an assertion msg Message-ID: <293a2156-6e0e-4e80-b31e-5d553e63b707@roeck-us.net> References: <20240221092728.1281499-1-davidgow@google.com> <20240221092728.1281499-3-davidgow@google.com> 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: <20240221092728.1281499-3-davidgow@google.com> On Wed, Feb 21, 2024 at 05:27:15PM +0800, David Gow wrote: > The correct format specifier for p - n (both p and n are pointers) is > %td, as the type should be ptrdiff_t. > > This was discovered by annotating KUnit assertion macros with gcc's > printf specifier, but note that gcc incorrectly suggested a %d or %ld > specifier (depending on the pointer size of the architecture being > built). > > Fixes: 0ea09083116d ("lib/cmdline: Allow get_options() to take 0 to validate the input") > Signed-off-by: David Gow Tested-by: Guenter Roeck > --- > lib/cmdline_kunit.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/cmdline_kunit.c b/lib/cmdline_kunit.c > index d4572dbc9145..705b82736be0 100644 > --- a/lib/cmdline_kunit.c > +++ b/lib/cmdline_kunit.c > @@ -124,7 +124,7 @@ static void cmdline_do_one_range_test(struct kunit *test, const char *in, > n, e[0], r[0]); > > p = memchr_inv(&r[1], 0, sizeof(r) - sizeof(r[0])); > - KUNIT_EXPECT_PTR_EQ_MSG(test, p, NULL, "in test %u at %u out of bound", n, p - r); > + KUNIT_EXPECT_PTR_EQ_MSG(test, p, NULL, "in test %u at %td out of bound", n, p - r); > } > > static void cmdline_test_range(struct kunit *test) > -- > 2.44.0.rc0.258.g7320e95886-goog >