Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2581526rdb; Wed, 21 Feb 2024 12:10:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHPMdvJjIJdJWWSny2Y6ad5x3BlKDFrh1oyW/h976NccJYJGvFs37+jaRzKergCkfZxxyGducbQSz9q86Yz9NH/wa2uNWom8xOXEQZ9Q== X-Google-Smtp-Source: AGHT+IFeBymGv64MQORJGSZW8hbQ1Jfk+WHkWlFl3WnsZWyLKGRas6g/UlH4PDZ0dDw2h4ubdkuy X-Received: by 2002:a17:902:ed4c:b0:1db:fed2:7a90 with SMTP id y12-20020a170902ed4c00b001dbfed27a90mr625211plb.29.1708546235784; Wed, 21 Feb 2024 12:10:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708546235; cv=pass; d=google.com; s=arc-20160816; b=Tr1yIiUcs4boZZsRADSNKK246dPbBKabHhx6lSZZcGNF9ZRvCpf4pR0PSgRMh0MEf2 6y6li9A/pLeeeat22CFxFlZx65v+xkkCLANZt4khLlxP32Ucu2wlVnYji3jfQdtdnYM3 VTZvfUO/ecQ0sjsVpKo2Ij/sS0hpLapWQRYdMH7EjTvULqhujqzhmb/KjVSQLHwkdMvC Sw+KBy6wtvKMjG87tG1lHudRKp1r1c9pNRqQQzh0AxG8U+y5THXOVlVHht3fZdUxZq4U hphmXLIAKqcz9Lp6Ji3HqZLpLENQF403Qz5Fc9gR64WC/IKMLM8Z3FlijYlgryTBxW0f VcZw== 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:dkim-signature; bh=M5Z0SZna9UOg1Ona+bZVgLrYz4/0TkaS32NjeJUhFJg=; fh=lIo9dformUyG7nW7/FXrI0zfxt0XDiM2a8AJIZrCBEE=; b=ZXy7XiolN7qLdZyoCDoH+quzeXdn6kbmdXFQtznCM6jlSZlAWXhEYuhpaOE7M8fgnK 7Xmay7U7Qn/kkKaH87d/GSpExyysjpi4AJorg68m2maawm00n1crhaFHQr2VHnxX27sM qfh7c0K6mlD59NmKVCRMVldYcMIcwwixe9mXuNXeKBehynMEy9qFQ12+eAuvB9s2m+dt jOeRMq86C3t/KT5CfkjeBtX2tYSEMT9h+/CT10eO6ccfYsnO3ElVL/CJe4U6HEYPCZf+ 9Kj6RCmKOcBkVN/PUK1hJ73IxkCO7DEsXz+XTfKcsHBUn8ko4LQIW59BO0bLT5+z3nvX Wq9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=H7gtXKyz; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id kd6-20020a17090313c600b001da1d3d7971si8875221plb.447.2024.02.21.12.10.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:10:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=H7gtXKyz; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75449-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75449-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 7826628283D for ; Wed, 21 Feb 2024 20:10:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EEEF86625; Wed, 21 Feb 2024 20:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="H7gtXKyz" Received: from mail-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.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 EAE4B8613C for ; Wed, 21 Feb 2024 20:10:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708546215; cv=none; b=PydM5o2RHbYP/QkJ38ENmG181j5BDm/7QbEzCUjIkO32IzbnU1MStbki2KDmt7y4pN1dVIxh60butdWdUi/d5opgYFjeHNu+quPViWL44YRYs0WVIHstQXbfKu6kaukx+bZeAD9AZnQ0JK3Tu3Dz9bY8jyKqFVbwiIv2UiU8/pM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708546215; c=relaxed/simple; bh=Gw1qFa2sTaW6NAX67zauZz8mX6m2BwqWtFKUyx8h/E8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c2bxSaE8ZLyK7hKjIxWJQ0nWTZd32s+hDeClkE9QpaZ9oXMH8/A+8vKA3BCgWlbG/oL300O2OqnMX9XUKZYTD6w2DwkRQJ/s25q3DfG5TYJRZMhxZ3CDdTwZgvFtrPNeWFaptqb9r41UpWtH/Zfziduo2pjRytIpkwD1f+edwO8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=H7gtXKyz; arc=none smtp.client-ip=209.85.166.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-il1-f178.google.com with SMTP id e9e14a558f8ab-3651607db16so621475ab.0 for ; Wed, 21 Feb 2024 12:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708546212; x=1709151012; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=M5Z0SZna9UOg1Ona+bZVgLrYz4/0TkaS32NjeJUhFJg=; b=H7gtXKyzORbMLg++gje0TM8sJmMHkbmFW85pgzHIa9cmfwdpuBMnxSErLUjTUJtHgB kzwQFpRKeFS4oJ/HMGvQz9wD8SS1iF636B+E4ZTV4lU28llxmgtxCdSA+NmD16wjNmiy zS6OdNmTtXbySfPzus4bc5NsRf6kaw4ZRzvHxgWvLrv7WV0DL8lK6XGvKLu4f47sMB6i dLGsL5KscgXmByVU/406oD3Ij3/jwnS2jbIM3VD8I69pPDSBP7ZW0VWRcDtXk2AqDEsy o16Mom8dSmYxV4Go4G3PH7RZCU6JipQCJVWFWxjaiT2pVpqoHUTje9w0/M25RVY4jfW0 GoEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708546212; x=1709151012; 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=M5Z0SZna9UOg1Ona+bZVgLrYz4/0TkaS32NjeJUhFJg=; b=EGXRuVmPSl+Vf0kWhgA66nLNsmaq2ZQqY+AJVDXakJCdc8rzlfqg0wcmncaAgA+6E3 bn+vG7kS4xHESpRuGZb29GKOXPTj4alr0zwEr7s+UwriDaryTmTd+vrltvl1XLAS0oQY 35dsKyDcFm1ynrke2HLwTO3Q5gCdb21nm73lRgHGLBEyCjtt2KI34zjIasreTf0p/z8d 9y+lr08R3vz8dmJYR5MobDrh+PI1Cqv+shSoW1BdtHJi+TcdVha0cPQvHCC7hXax9m8U avhSAxiL2kCN+UsDLJHc33t6atH3DbEjjOPwNS1T5aFSxnBRkNp1oXf5DBAJ52bzBrmk XNog== X-Forwarded-Encrypted: i=1; AJvYcCXkoJpVgGanKh1vfB6ZFYBsUVkZgPb5CJmoC6dpjNsimdM0nVbYga5XKfvB6yxFcQjzDjEBMCOUGIFsAR1U8bOlG8Rfol3Sq6ONbEOh X-Gm-Message-State: AOJu0YxcXBxIVAJUEdtubvy+8WrmS44gLCCUSr1MqW7J0dIOEMrhszbL 7uBsDdwQNgvdq2ZZVtQafN+OngUYq3lLd1JmdKj9hGl1VR7awOmvhFH6kc5B2w== X-Received: by 2002:a05:6e02:1a0e:b0:365:249c:690 with SMTP id s14-20020a056e021a0e00b00365249c0690mr505292ild.9.1708546212041; Wed, 21 Feb 2024 12:10:12 -0800 (PST) Received: from google.com (161.74.123.34.bc.googleusercontent.com. [34.123.74.161]) by smtp.gmail.com with ESMTPSA id t18-20020a028792000000b004715e8aaea2sm2842840jai.102.2024.02.21.12.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:10:11 -0800 (PST) Date: Wed, 21 Feb 2024 20:10:08 +0000 From: Justin Stitt To: David Gow Cc: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , Christian =?utf-8?B?S8O2bmln?= , Kees Cook , =?utf-8?B?TWHDrXJh?= 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: <20240221201008.ez5tu7xvkedtln3o@google.com> 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> Hi, 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. I think %tu is better. d specifies a signed type. I don't doubt that the warning is fixed but I think %tu represents the type semantics here. > > 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 > --- > 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 > Thanks Justin