Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2250619rdb; Wed, 21 Feb 2024 01:32:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWOfTN4PBb+kdN4nM1rc/3M5caH91cmD5l+Tzm+5u14TZ5lXptm6fly9psyc1mqp6gpn6NWOOaxEw8Rk9mMgoLu5YeSX1zbti/AVdH5tg== X-Google-Smtp-Source: AGHT+IGGjdcWreJ4x89AYINq7KLpFVv/ekZItoIc4Ahgh1J1jbTf6wjd4PYbCD1j01/uE4urMboa X-Received: by 2002:a92:d981:0:b0:365:1035:83ab with SMTP id r1-20020a92d981000000b00365103583abmr14765550iln.32.1708507947782; Wed, 21 Feb 2024 01:32:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708507947; cv=pass; d=google.com; s=arc-20160816; b=X941/HBMN+MJJH3n5bwni5G+dftTJB9gQV/1795CxKAcHsHLgsK9VPfx4MJcXg8s1B gSPoix4ddcAubI8PM17JNPMoXJ1CAN+j7vYOMUMmK9lNUiAasw1c7/8Izo9UZ/+l0N1S 0zDhtE7/1o70FQ+PCKEQN8CbxytAOOBhA+tUgN5+tk5HkMQNforupwAu3IFLQmxKiJXV R6ym3hKU8vQ+93PnwJPv9p5s0ZIdjvrjVxz34PeyCovblXbbsW3ya6m6Fo1eNghXhT9y 2Fow8pYqgbKdvrVDARU/S+7q/iUdtsxQfY2TLn8VRWaR35PjOxkjP1PXOBXGe6ch6g4u sK+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=NeQowu5ygMbqfsZc+b92OS1HjirLANcwpz/yagEqKMA=; fh=Et8PfYfv8xhqN+aQF+RAHGnHkoLbfNg2HjqE2+OBir4=; b=fr843mq2KCYbFU48kNxs3/uZ9gzGRUVlTqUy9j26WlJsuN8beew4Tlb6rzLfdhDEoQ btILM28b2n1iqeueTCYe4J4GqUUCEVJIFV5o7Cfipk/LzADlxPDdr1QFQeYftnIEiOhh 3U908F7LTguY3fwJljykaZnGOLQeCuskne6i1Oq7CjXdM7U4O8oWX0BkRhM6Cs9MNn6l vZh82FinorB1xgUeMZqeyKFEsHN2ZrV+pXUWNl6JsyuCJUYkANbCKUMmhI9M9O6nhbCR ZBMehQTjLpdkZ1zROUHWbm0rv87OkoANuoxHJrYNnMZVCFTdONbn88oqvTh1IDTC6dwa yw5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hpU1mo4c; arc=pass (i=1 spf=pass spfdomain=flex--davidgow.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-74401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74401-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x64-20020a636343000000b005d412d0f51esi7804900pgb.661.2024.02.21.01.32.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 01:32:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hpU1mo4c; arc=pass (i=1 spf=pass spfdomain=flex--davidgow.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-74401-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74401-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8BDB9B240A5 for ; Wed, 21 Feb 2024 09:29:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBB683D978; Wed, 21 Feb 2024 09:28:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hpU1mo4c" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 D92223D97F for ; Wed, 21 Feb 2024 09:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507693; cv=none; b=atzNs0lfP1vrGgS4VbLxHQLvH3oF+8pPFPwDVyxndQ/ggypif/ReV/T1N3uBiQzG3mZdl+dGi0+/KT6UT4wunSa0XGf6x4U3T8V8nncMTl0B+LFJTCoJpRa9aTLlWOzxyjKMShzGvKQFyKQP/6coxZF/BwNNtZ9nrore/efgGaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507693; c=relaxed/simple; bh=Dmbe5BP8c+8aPc1x3J6VMn8AMWKKdm1dWr1AhfYnkWA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IGbHC4nv97ojVDVbxRJzTgclL4iqOS4RZ9WLr12Y7TySM6KNETOC0m8pCCLDEvbeRuhyVzMSJGzfh/LZYQXUUR39p3I2a0S940sRBnugpqGEif03i7eCwIg+3kLTuNTEUR8vWNl8+cN2ejnSbPPjhbxiRtffTu0/nqbotmXpELo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--davidgow.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hpU1mo4c; arc=none smtp.client-ip=209.85.219.201 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=flex--davidgow.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b269686aso9891154276.1 for ; Wed, 21 Feb 2024 01:28:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507690; x=1709112490; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=NeQowu5ygMbqfsZc+b92OS1HjirLANcwpz/yagEqKMA=; b=hpU1mo4c4VTOaQ/zVlQmv4i7QNv4xa1OmIftHY/i6aT9JV07sXoNBTk2w44z94zsIz Ljhu+Zn3S0/XMosXhJs2mf6h7qi8QKM4NG4iCHeLwUds3lrrUTDD3ZnkgPffF1gheDyV 7sOjZ1fEm166dcVzljViZzv3N73d79lOwT64ZIXsoMWhQPeeZt0QeANi4WpYEAsbLk6s DHm35Y91ZMS3uKeZ3dELhM9GT6JmM3d7QIcRfGGIHhz/jktGtdqlE3u7envfX1YL7g0H LUplByodsH6N2WrPeNquOH57ZL4BXva3havvfWeeB1f4Hopkypmg384oEusnYKnPo1Bn QrCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507690; x=1709112490; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NeQowu5ygMbqfsZc+b92OS1HjirLANcwpz/yagEqKMA=; b=GG7FgK1W50a4OVZLEKMJpUwdTbZ4t1pzIBML8UprTVhhfpYuLqvKKmye4Hd22L6vDf g7UgsJjcMRBf3XquZFx3jlv5N4ytg1mBHqyK1WPALFECJEA+FOSh0TZo4+iO/Apw9SID xQaExPozEn2inBNHACcKz53m+v2zFQCRQNcIsA63bDLWTCdfr/bKVuCcHA9fhazGIm2L xjNa1I0kPNoC/GnLO8+Fw4qYsGyeWMWi/xKtzC8SacRVrDci/vKOl9nr9VBlpYi6dKw0 bb4Bc9pDcZDgiSB9OQA/DHqmYz3EhGPQ4Pj2M0jTC/MqRoAejBFMsyLXhgLxIcLAnQFx LlZw== X-Forwarded-Encrypted: i=1; AJvYcCXnip+C76zJz6Mv6Ikmgl/4QBhM3dum0ErlUJ5E0criaARikegvUEx6Wkbrs0zJHgHsUzfNV3ZOGsjlG8ue/1YUcx/tttgFe/4g7LKd X-Gm-Message-State: AOJu0YyOChik0EnVYDrTyWKJXITNpa0hlkkw16wm5vs4M0aH/aWHmB02 wIoK7UM2Wp2Va44vsT1Kh3sMGGJW9z56FVZ09MYBJXp+h6CA9UZUghCtCaaYtKBNG//mM8ktbqB LDOjJSfJ59A== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6902:1001:b0:dcc:79ab:e522 with SMTP id w1-20020a056902100100b00dcc79abe522mr728743ybt.11.1708507689903; Wed, 21 Feb 2024 01:28:09 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:15 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240221092728.1281499-1-davidgow@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221092728.1281499-3-davidgow@google.com> Subject: [PATCH 2/9] lib/cmdline: Fix an invalid format specifier in an assertion msg From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , "=?UTF-8?q?Christian=20K=C3=B6nig?=" , Kees Cook , "=?UTF-8?q?Ma=C3=ADra=20Canal?=" , Rodrigo Vivi , Matthew Brost , Willem de Bruijn , Florian Westphal , Cassio Neri , Javier Martinez Canillas , Arthur Grillo Cc: David Gow , 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 Content-Type: text/plain; charset="UTF-8" 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 --- 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