From patchwork Wed Feb 21 09:27:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 774730 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 D92AF3D980 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hpU1mo4c" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc64e0fc7c8so8957990276.2 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=WSCTrZL0XODmEEYWKoHdWir1RClqVNwOrk9VWyPAPnHlR9pTNVX9OnF0GVjOxvPmRe LvJtWgfXUZ/rsSZ3TmphjgDvUv6z7vBPx5lzrrrTfWTrgz40Jo7WP4HAnWn/dUK83KTg puxQO6jjBbTDw4G60NqWeEyMzNwU6NMZ4AWHsScKWEgHJz4hpusZUU4O/NsuaaXqAbe9 bKg6SxfZBUW9E/yjAQ1fPAqU1vAG2lJvrkQVJFpDPCYyYUhqSLxhoVOMk4/SG23ruSGn dzZLjMx8dj5ntISx5LxMFQv9tOkTKYgPYwarp7iYJlQhGjFGpdydwWTHq1YdIt3mtR/C j8uQ== X-Forwarded-Encrypted: i=1; AJvYcCXse6Bk4qFXinj8XBWcNc+euy2QFr8DPVe/aQJPKEQSBRQSX/uMzOhKJuZofoDQRW8AaJ4YGimPbEYvO4wnhTv2s9BWUYt/Qb0Gn9X/ZxwS X-Gm-Message-State: AOJu0YwbvPmVq3qjG/WWOwLu0msfnqEUP+oH8TXdTP+lhoI7ngUcMP1y UTAQbl8HhXT4SScgA2WlzGpBQ5g/lYfQDObxQ0d+Um7c1CesjEhFe/jtYhsi/nU0VL+KTcDmdIv 7DPXppQLx0g== X-Google-Smtp-Source: AGHT+IGKmHDvlseXRZ4Y+4ut8ocdYLBEplEGH+dd9qwAR6JMHTXNGTF3psUQFQki1OvQHuO3rgwKUwj3z7weqQ== 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-kselftest@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?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , 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 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 Reviewed-by: Daniel Latypov --- 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) From patchwork Wed Feb 21 09:27:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 774729 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 BD8213FB2D for ; Wed, 21 Feb 2024 09:28:19 +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=1708507702; cv=none; b=ir14ThORYe9jQyYQdarr2UTu0gm4YY4cIKPJoiSP5dOqv8hEtP8HOE5VQ5wR6S/KjEv8Fe7UL6zOindtO20bUKcMexCbBmHJlItaGkbqDmIQi+KsIM2/Zs8YFqRKceoAlYHAGPlhQ24doxN3L0fdC9pJQxGqoBmz8kr6k61dJQY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507702; c=relaxed/simple; bh=oL7SbspJOeRYcbVFVBGkFBZAmUlrMB6hGfPhSOPP+r4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=S+on2ktwlHH8A0lSn3+FhSTJs9fV8omCDIawdOE4ivkrkWUfR5rLY2BsZJsNkP5ounJhbZpwEzxVfz67nQbKbFLwajmDLhRcxs/hezTILtPPZjilnbJ83u/HzkvcVt5ZENi9mjh48snT49vuCTi6jBQ48Z7niFyrk1pjHDB82WI= 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=b3AoQfXx; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="b3AoQfXx" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dcd703b721dso7921114276.1 for ; Wed, 21 Feb 2024 01:28:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507699; x=1709112499; 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=Z9U7+OVqCU0rhDEd8d2z0lAB4Gret4PnmLwRYwmvgX8=; b=b3AoQfXxx988FHyX9PzELXt8NrrvJobEFyBhth5Q2rbrtTy2d+2wd+HOEyGFNMuOHo n/oPbIlMp1nrledzymwwjSpwJQgwhl3MPqjMZv18VG+7yE2c4/AhCocx4fGXkGFcGEWE N3Uz9mFEfVcoB+2bkskC/YugYC0VUbJdJrKpFzzPLnwJxWbkP8pM9hl/tWdMYC6RZ0d6 0wccmsGWSQdrDTYzEBTx5q4gwuEAVH5324VNJei90wylyVjUHjubfPTPky7GkxN99y3A U6iNBk2+Ip0VFdATBZ5YUvA4W6HooAq1k9G0Ld+P7WYosQKGWZWjx/bHIn66PwE2EVoH fDyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507699; x=1709112499; 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=Z9U7+OVqCU0rhDEd8d2z0lAB4Gret4PnmLwRYwmvgX8=; b=FCie+TEyFdu0KQqHvOeLMvW/orW8B5/2bAllhhiilAvJNnaC9uEZ7PWY/624y3dNd+ 4VboxAw6iAI7zWyR23c09Cnx3R9nvdTWXBxSwvM+qwHJ6OLCic+bt4MdSlMq+XjvfRfB PNAnzEB5NlAMvKZBzzwPYLmt4iFQ8AuJTSo9jYcx32QVgRX3IdpN45/LwnjxCH40nDny i3JZmXpaLQmwwj+T1ogZBrH2K4DKMIoS9SqG2FfPtasJX70mrBoRYu1Y7J29N+lBKVN3 lkAR2azuHOcw+25TRimeHKjKUji9hz5/ylsWXJt3lBK4z8om/Cjdyj9FPsJe/K1G/c+D 30Hw== X-Forwarded-Encrypted: i=1; AJvYcCVHruwmqf/ta+vdYEM69zDNu9vFpiSorgxTph68HteMZM6hpoll7RhEoJrl5e40dzdvfBdpJLNiZ+dA5wR4lCkblmegwnAa8D6EQCN4kMj3 X-Gm-Message-State: AOJu0YwcUOJ3Oi5pjsqyk2rzYei/g/MpYbZECw86dGS8RokmfFdwcjCO lhs7rLgDOvh1O6RB5DlRX+X8M7iOQHECpHixrqesQTYdP60V7TsvzCIqPzVL1gufYFxRcB0ERlq HRyQPW2ReNg== X-Google-Smtp-Source: AGHT+IHQmEZgvDehwTVbCeyhhzp67M3ZAq3QtZNAjC+xaNviI3L4AtsF+O/jA3jQTZUOnw086+ZCDp3kuUdK4Q== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a25:69c4:0:b0:dcc:9f24:692b with SMTP id e187-20020a2569c4000000b00dcc9f24692bmr1016456ybc.13.1708507698808; Wed, 21 Feb 2024 01:28:18 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:17 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@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-5-davidgow@google.com> Subject: [PATCH 4/9] time: test: Fix incorrect format specifier From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , 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 'days' is a s64 (from div_s64), and so should use a %lld specifier. This was found by extending KUnit's assertion macros to use gcc's __printf attribute. Fixes: 276010551664 ("time: Improve performance of time64_to_tm()") Signed-off-by: David Gow --- kernel/time/time_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c index ca058c8af6ba..3e5d422dd15c 100644 --- a/kernel/time/time_test.c +++ b/kernel/time/time_test.c @@ -73,7 +73,7 @@ static void time64_to_tm_test_date_range(struct kunit *test) days = div_s64(secs, 86400); - #define FAIL_MSG "%05ld/%02d/%02d (%2d) : %ld", \ + #define FAIL_MSG "%05ld/%02d/%02d (%2d) : %lld", \ year, month, mdday, yday, days KUNIT_ASSERT_EQ_MSG(test, year - 1900, result.tm_year, FAIL_MSG); From patchwork Wed Feb 21 09:27:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 774728 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.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 CE86541238 for ; Wed, 21 Feb 2024 09:28:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507711; cv=none; b=pA2KAcddwMq1OaLNwl33HKVjKLXkCRbBjBp8wEtA5MhI/szlByBmIO+Rg0TeBV2Evr+f5+7y4a84UN6aqVYdWffLzRA/D0jMjubls/zRFOhLZQP705VLi41uKnOT7LSxVVKYoRraM25vgP1gvkj+5aAJotbi7PCb6TXlsdG5jis= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507711; c=relaxed/simple; bh=Mu+X+yYW4cvmC9NQvhPl5vvHTK1CoiY4aafGL8tDBao=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=FjWjTuObmtveXLPtY2wB9htxiFkdNUS3s7XtAnfwNI/UuB08OaaV6qJTerbKicXAkRUMZrm0fKAnC9hP1QUO24L36tMU9c2qlvtMZst5SVkFMmCxmupMz4m6aDBqMPRwfAoIhm9/fXRhFK4cuYSU4GA+FghK53jBpERZDa2ExUg= 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=q9pFYzKQ; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="q9pFYzKQ" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607838c0800so82851507b3.1 for ; Wed, 21 Feb 2024 01:28:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507708; x=1709112508; 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=l+N/x8q0XM6q/oxl++oFE/zLIduvg/H3kbNqGrSm6L0=; b=q9pFYzKQA6kltZmFbrzdKjQhTTjCVsENKULtAAj/is4cgaEBuvUDnYYrgrPATdGfB4 B5Izv6MUwuUJKl8ix+oHSB+9Nw+86DsOuPgccNKWV2pQ1UU1aRfLgtg4E8b90VNoCCKy d7XE4OZcNf+5/3lL35N9TygGamSl6fDjeFX2mQYhPl4B8Dletz4oaSgrB9296lEPkcXY sJ7UaiDAy8j1lvsSqqD8h84HPlnsMJ6pfpPEq3hrqI0dnrJAzY/ZQgR6bJ8do1phyOXO 257g9vZ1ZsDgd8wngEQP7Fimbkj58R5r9iMN1WDcE+juk6m2yIy+3qnnYreQC153EZsU GEgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507708; x=1709112508; 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=l+N/x8q0XM6q/oxl++oFE/zLIduvg/H3kbNqGrSm6L0=; b=uNN2b2oGHbdd1OsMDoc4iIaDY0a5OQDMGPAJr1FHzpmhA8oXboClb4XHXuNOfbZTw4 uL1a0kCMNjSh6bGe1q0eFc4Vp8LaYFgNj123OfYS+0gfX23/aY/3EBEyWQ/EESGzgbUY ka/yiY/gfERjXnoa3clNlhi+WdAEhM+IZ9R4DMZCbAuMvAaIROne+Owv+2GB4KTN+OL9 wxq2gnyIlgmVEWcDl9DeRDcRRpZityD2Md/0hF19gIgLeBVSgfwNNFsZfD0YG8HdOtE7 FXHdQrMTGSDAkApSwT9ABgVvc9JYz7zuQdNGBAwlkejsQCU+OCiMIX8UtnGLON93KD75 kk4g== X-Forwarded-Encrypted: i=1; AJvYcCWP8IQu7Paec4AS2vEHgbm/Pv5p+vNIXwU5dQfPUBS+t8EpAsT9PXcuKv7PRkYi9FpKoRkBeYc1JfVUjxkwlt8voUubMv1UBRM/Cv119mqa X-Gm-Message-State: AOJu0YxQTF6M/rFF73W2+oTqyGsKphfzULwUnISTqwVquAnMe6JEZXZm gWEFw6cpixam8D2osz8ZiFGCytqOGJX2zATkC4PngUpvyW8zs/nD9lL20l8qrs+tJw7DFIgySFU hE3lr9Z/18A== X-Google-Smtp-Source: AGHT+IGujiTgGmrs6aB7MYtXNm4zgRA3Zr4vV9toQOw9f+upbD+oRsb+6ooQYjPHHocWRD49vELQV317edlmfg== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a05:6902:1081:b0:dc2:2e5c:a21d with SMTP id v1-20020a056902108100b00dc22e5ca21dmr5584522ybu.6.1708507707855; Wed, 21 Feb 2024 01:28:27 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:19 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@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-7-davidgow@google.com> Subject: [PATCH 6/9] net: test: Fix printf format specifier in skb_segment kunit test From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , 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 KUNIT_FAIL() accepts a printf-style format string, but previously did not let gcc validate it with the __printf() attribute. The use of %lld for the result of PTR_ERR() is not correct. Instead, use %pe and pass the actual error pointer. printk() will format it correctly (and give a symbolic name rather than a number if available, which should make the output more readable, too). Fixes: b3098d32ed6e ("net: add skb_segment kunit test") Signed-off-by: David Gow --- net/core/gso_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/gso_test.c b/net/core/gso_test.c index 4c2e77bd12f4..358c44680d91 100644 --- a/net/core/gso_test.c +++ b/net/core/gso_test.c @@ -225,7 +225,7 @@ static void gso_test_func(struct kunit *test) segs = skb_segment(skb, features); if (IS_ERR(segs)) { - KUNIT_FAIL(test, "segs error %lld", PTR_ERR(segs)); + KUNIT_FAIL(test, "segs error %pe", segs); goto free_gso_skb; } else if (!segs) { KUNIT_FAIL(test, "no segments"); From patchwork Wed Feb 21 09:27:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gow X-Patchwork-Id: 774727 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.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 119A645BED for ; Wed, 21 Feb 2024 09:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507719; cv=none; b=sBTJBhkSlUbeKk++b0kmds/vTZe1Hhti9xKtool4VL6XwIaPzDZ+N5YrUQA0oOvZfv9mx0RPRkYQzbpmvKo40Q1Xn+c1z2rhcCVe48IVeQFou6Q7XZjzP2p65ng5sZKsrF0qZC4MDim9ibJjjxx1XqODanVEelZ/hMp2mHFkuho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708507719; c=relaxed/simple; bh=w3euWTwzMuy4B32i9R1sF8QJYNBjDCrCALXsWQpTZrQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=n//gDWWzk58af9EgpIJ1D9+gpApNhyxqfQqmXeEVHXDoNQ1NLuJ8PMeDMnxGlKEbxyEToOFH86OZZ3PyCxX1Ye3sxi+/9Bd0Ttnf8w9q6IE8GumHbAmUI3EX4Pjyw1jOUis5H4i0L1p911cNThRSqJc60VJ5DWIHIOJc5T5eLAI= 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=vOwtwY9T; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vOwtwY9T" Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607cd6c11d7so94376667b3.0 for ; Wed, 21 Feb 2024 01:28:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708507717; x=1709112517; 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=nYdfpz73mSSQOJip1+ZL+ticY/JfIGD+cYhY46XA/58=; b=vOwtwY9THzRu8jN1BfHjuDKN1Vos5s0uKgwfs1S+tsZ60qBH0oisg9p8CN7UdykxeL KUhm1pdTTFtoi7qIZYc47tRWnqpRvjwi/E3KJsCmYj/nNP1FIrSY4oG7Y2RS2euAEVfG 7VG3jClqxR6tJqf1OgD0dTyha7OE7mruVDuz7e1I/Bea6Af8pswjP8eOX1mxTmq7o3sX TWgYO6DxjEyxhn1lNwWlCOdQ4bwwgADv9KgQlDHuWO0C4TJZGNfSnLTu03K5KYGWvUlm NMuwIyxGA19Z1PJ8a/WYeRuWV0yePTA9Wuy+jwMWFFsI+dGLsiInpDlNdvM8e4kEqryo 3yXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708507717; x=1709112517; 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=nYdfpz73mSSQOJip1+ZL+ticY/JfIGD+cYhY46XA/58=; b=csju66TqWKA2yk94YzsVNaXcVfXBQFWdjV1pAnnGuVdzMt5j7YHGygkB5QevH7Jzoq ktl0BJZMrMCkN1FeuR7RBD+MOwmQBQZJwxqe3zHFhkG2kb9YguuVOaJv1LiWS4Hdjkna dzxdng/EKNgvir0S+cD55CN+kb3sOgLruZRqJQM/+P7HECc2cjd3ecT1pmpajhItcRaO HSUFeika86i16e9cdaAeI9UiKKC7wKWthUrrU2ULWJWF9w3+rhzJwcKgD/Z23n9/EX3I gjbeoo4be2LBUJLa36Kt3/Q4F6gLbmdCcXWqbOT9SDuScWzUc6pL0nPUASc62CWaAxec QOig== X-Forwarded-Encrypted: i=1; AJvYcCVGJdBy4/EvkE9o8EiL4ogbP2A6cgoHMmLY8U/7VqzcKpO5asLgFvIZRP9QdP9IZNaORwKmrCSOw5BmZbqLdSmeaCFV1NQ1E9xMAPwt0VQp X-Gm-Message-State: AOJu0YxJYJjJO5p7wJF3sDn3T25nKKakxvBlz+NTvfrzwJk/xrFoT3DR OAW4GbBFMW60Q4yeaQ0YsdaIuDd6zPq2Z6Y7NYAa4C8xaXNSGKIPZVPieiVL/tOdTS/QhhDDVz1 Bt4G7coCNnw== X-Google-Smtp-Source: AGHT+IFa/fu29ZmsVki9pPhB5PrTsNvq7jb5hiZUPefFb8PbN6D0cYOdutojAKCl/4VlBY7r3iK54hwJmjuHsQ== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:20a1]) (user=davidgow job=sendgmr) by 2002:a0d:d685:0:b0:607:7564:a830 with SMTP id y127-20020a0dd685000000b006077564a830mr3019910ywd.0.1708507717035; Wed, 21 Feb 2024 01:28:37 -0800 (PST) Date: Wed, 21 Feb 2024 17:27:21 +0800 In-Reply-To: <20240221092728.1281499-1-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kselftest@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-9-davidgow@google.com> Subject: [PATCH 8/9] drm/xe/tests: Fix printf format specifiers in xe_migrate test From: David Gow To: Linus Torvalds , Shuah Khan , Guenter Roeck , Rae Moar , Matthew Auld , Arunpravin Paneer Selvam , " =?utf-8?q?C?= =?utf-8?q?hristian_K=C3=B6nig?= " , Kees Cook , " =?utf-8?q?Ma=C3=ADra_Canal?= " , 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 KUNIT_FAIL() is used to fail the xe_migrate test when an error occurs. However, there's a mismatch in the format specifier: '%li' is used to log 'err', which is an 'int'. Use '%i' instead of '%li', and for the case where we're printing an error pointer, just use '%pe', instead of extracting the error code manually with PTR_ERR(). (This also results in a nicer output when the error code is known.) Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: David Gow Reviewed-by: Lucas De Marchi --- drivers/gpu/drm/xe/tests/xe_migrate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c index a6523df0f1d3..c347e2c29f81 100644 --- a/drivers/gpu/drm/xe/tests/xe_migrate.c +++ b/drivers/gpu/drm/xe/tests/xe_migrate.c @@ -114,21 +114,21 @@ static void test_copy(struct xe_migrate *m, struct xe_bo *bo, region | XE_BO_NEEDS_CPU_ACCESS); if (IS_ERR(remote)) { - KUNIT_FAIL(test, "Failed to allocate remote bo for %s: %li\n", - str, PTR_ERR(remote)); + KUNIT_FAIL(test, "Failed to allocate remote bo for %s: %pe\n", + str, remote); return; } err = xe_bo_validate(remote, NULL, false); if (err) { - KUNIT_FAIL(test, "Failed to validate system bo for %s: %li\n", + KUNIT_FAIL(test, "Failed to validate system bo for %s: %i\n", str, err); goto out_unlock; } err = xe_bo_vmap(remote); if (err) { - KUNIT_FAIL(test, "Failed to vmap system bo for %s: %li\n", + KUNIT_FAIL(test, "Failed to vmap system bo for %s: %i\n", str, err); goto out_unlock; }