Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp659004rdb; Fri, 22 Dec 2023 00:38:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpa+x9B/6JSHVSgorjGidfSBsGz5EwQQjlqJaq3bkwQhWEcS2TpQZQ90G+qyQUSyD3bMc2 X-Received: by 2002:a17:906:51d2:b0:a26:9c9f:c2e8 with SMTP id v18-20020a17090651d200b00a269c9fc2e8mr355175ejk.32.1703234314704; Fri, 22 Dec 2023 00:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703234314; cv=none; d=google.com; s=arc-20160816; b=GgeZkxBIucbvKMMEqGmD7sx9Y+v3/BPKfvKx5JMkEpny9y+O9iTsHsDlIxZgrqjsfr GK58h7NwIpf8/yDpJFhhrA2K7NueP11EtLr3DYgCFd9GY0q6Ej5/uNLmyu1ZrNkwPUlw hNtAWhxsk38vfsssx+j4ynBObkERNp1/n+Vw0yipyIsTYDGvVNMGtTyuSEoK2DS9WYS5 mwszty7JuHjWVhdNMU212fwtJPzbEH0Bnr323ByUzIO9Zrq62m20oVz2/G5Xx1S6rcCU P2mU2W53XV7mBPL7WAmErdDVw9NY24wvs0vU/G2FnZAb4FSdQcIiQBKZXolhgnfU69Fz HKnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=M9gEBP5WZhQN72UvWshrtsPpY6S5hYOD8xYFlYJ7oYc=; fh=YpabPqT0rrtroFAsCgBNWEisidGWuXjqGZZT97zkK5Y=; b=c8IB47M1z4ArHI1Doo3sv/gYEC0c4dyeH0a+1u69/VP/gftycD2IV6m5ers74u6k8y ub2NhzQeow1RrYz8RKKCQrBHivpfdqd5sRChKbivsfVJ1F69/pPYPwsyUrNHMK5aNVzt 344w/FSBySsxQgFPkuw4Em+CqBXIOHMvRAunaOsaMvOg/ME3OlKQP9mUcpLgbDg/plD6 qt63Md6o0nmbhJDZGqWui+lExjg7yNuCNUFsVHewJGlpjIAzwzpzPYt7SP+O0WLrE0bj 6gARJAcJSrAhysQRMCLJinIeibEVCCrUjh4Htab2L7WaAwPay1w6IlN7E8swxEoetewv kgAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rMnLjVVj; spf=pass (google.com: domain of linux-kernel+bounces-9507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9507-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id f10-20020a170906390a00b00a233b3050b9si1528355eje.869.2023.12.22.00.38.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 00:38:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=rMnLjVVj; spf=pass (google.com: domain of linux-kernel+bounces-9507-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9507-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 3CE541F257D7 for ; Fri, 22 Dec 2023 08:38:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 500F4C8D4; Fri, 22 Dec 2023 08:38:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rMnLjVVj" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (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 085768484 for ; Fri, 22 Dec 2023 08:38:24 +0000 (UTC) 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-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-54744e66d27so9834a12.0 for ; Fri, 22 Dec 2023 00:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703234303; x=1703839103; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=M9gEBP5WZhQN72UvWshrtsPpY6S5hYOD8xYFlYJ7oYc=; b=rMnLjVVj5m0VPvWpbX0ED9b+06sSw+xcD0QRdfNmInWjqshnuqg6Lki2yTGDy7Nwo/ kmlrkpdrsur/N0GYHzPU0YewJHAr6A8Kug26cWoLvSq8OH6KsFmrRRR39qW3hJkaN1aH hkSGdx4apvZa4gzVRwZSYXY0Ryf1H0kRJR4ehAmL9evyvqse3uz08A4TbBOBSdf3wd1r NRdstdgzB3oKeoyJme580GrvfUMrkSYumYQ8659jZglsTxfBEufEoKkiiMXEYlpGiWau oMOh8IATJjT8Vg+jiallD4KM4eBP3xnxcaQlUIjOv7HJiNgNczpHKm9aiFqN47jkBrTM MO/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703234303; x=1703839103; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M9gEBP5WZhQN72UvWshrtsPpY6S5hYOD8xYFlYJ7oYc=; b=tznKkTgAiI6mCHDf2IIH1mR1kcH6tNuU0MbbG1aVrUqH3tiAXQusWbG0Na96fbbSId OIMHvPD++vM9sTxuAN/ypLxcmBSxDvg294cT2ZVqRtjHQl7OhaBJk4dmy8rMuWzdVbfj 19iRITqJxfPuMD+y7l6H+c2/Qs5WoyCQ+P12LrLcOsz4B8zuqloF6+HBK6iKlHM6vd0o gfaF5KX8AFJeSc3zHXzsjEuhgGFIYSY+ErBTnliKJ3aM86CHbIAwtFEyUCgHY217tike cIYFH8xqOxJcQc1nVsFe3+ie56E6kh3D2Ps22s/aqmmqRQsSK5fdKfHorETufgQK88eX Qkuw== X-Gm-Message-State: AOJu0YwtC7nitpSIcQf18Z8YIjsNMne/Oe75Eq8xOjxymppi5WFlVt22 SQaK5T6/7isvxZteys0iDqSSes6bhwQjk715cUPh710tRHf0 X-Received: by 2002:a50:a6c8:0:b0:553:5578:2fc9 with SMTP id f8-20020a50a6c8000000b0055355782fc9mr58735edc.5.1703234303216; Fri, 22 Dec 2023 00:38:23 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231218151729.210027-1-rf@opensource.cirrus.com> In-Reply-To: <20231218151729.210027-1-rf@opensource.cirrus.com> From: David Gow Date: Fri, 22 Dec 2023 16:38:10 +0800 Message-ID: Subject: Re: [PATCH] kunit: Fix NULL-dereference in kunit_init_suite() if suite->log is NULL To: Richard Fitzgerald Cc: brendan.higgins@linux.dev, rmoar@google.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000a2e4e4060d1523cb" --000000000000a2e4e4060d1523cb Content-Type: text/plain; charset="UTF-8" On Mon, 18 Dec 2023 at 23:17, Richard Fitzgerald wrote: > > suite->log must be checked for NULL before passing it to > string_stream_clear(). This was done in kunit_init_test() but was missing > from kunit_init_suite(). > > Signed-off-by: Richard Fitzgerald > Fixes: 6d696c4695c5 ("kunit: add ability to run tests after boot using debugfs") > --- Acked-by: David Gow Cheers, -- David > lib/kunit/test.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lib/kunit/test.c b/lib/kunit/test.c > index e803d998e855..ea7f0913e55a 100644 > --- a/lib/kunit/test.c > +++ b/lib/kunit/test.c > @@ -658,7 +658,9 @@ static void kunit_init_suite(struct kunit_suite *suite) > kunit_debugfs_create_suite(suite); > suite->status_comment[0] = '\0'; > suite->suite_init_err = 0; > - string_stream_clear(suite->log); > + > + if (suite->log) > + string_stream_clear(suite->log); > } > > bool kunit_enabled(void) > -- > 2.30.2 > --000000000000a2e4e4060d1523cb Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIPnwYJKoZIhvcNAQcCoIIPkDCCD4wCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ggz5MIIEtjCCA56gAwIBAgIQeAMYYHb81ngUVR0WyMTzqzANBgkqhkiG9w0BAQsFADBMMSAwHgYD VQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UE AxMKR2xvYmFsU2lnbjAeFw0yMDA3MjgwMDAwMDBaFw0yOTAzMTgwMDAwMDBaMFQxCzAJBgNVBAYT AkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSowKAYDVQQDEyFHbG9iYWxTaWduIEF0bGFz IFIzIFNNSU1FIENBIDIwMjAwggEiMA0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