Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp4964131rdb; Fri, 29 Dec 2023 23:20:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzKljo33ecdHlOh2VWRSrfxaFDUvmGeJkQMf/fdRUFdNTIoNSDJQ5AIyd8WWO3+fPhWEYM X-Received: by 2002:a05:651c:552:b0:2cc:6f11:1f8c with SMTP id q18-20020a05651c055200b002cc6f111f8cmr6502833ljp.20.1703920817261; Fri, 29 Dec 2023 23:20:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703920817; cv=none; d=google.com; s=arc-20160816; b=gC8WhjreTd81+DizG7dUehv/Fzpr8fNzwI+IijBJon04uWk5uoTlhqvU5UQeRXBmtT l9mEX1bX9R5j6kWUs5qKz9/s/sOpyLLGtcefahlOojBNAGtUXGzTeAbyHNHeUXiLg6ST /V6Cj0m5wactr1XzeCvQ9HmvDdi24nv5U7zTAMxGVkC8eetBSDhl7QiKfwHk9kHcCJ9W mkYAZOFCSVbxYYdG1odStYNamdFnlamPo4wXcbbSZgFr5iOFd8uTeZ4R9STdRHWnw36x E7z4d2WOFXkZxOk/9GlMiinntE+87HMhbIOXUUbsTVisNTNtQPxTvwP1cosUe9pBBFSC rbhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:cc:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=xZsxZNhGTp53FzCcJw6uGbOrRPnJKaW09uwN7Gtkk9c=; fh=oOhgVbM8m3aJGRSnTTM6KTF3eVQYf5X2ybF1CBlpGdA=; b=WZ+YSdCpF2ke+TFl5dZO6twe+0sSwmQIjDpNE+JVX7TTYIKuJxytPK+xuDSDQ9bC6T I6L+IEqJKtYrvNWBKBVgnes7FWJhTgkFI1113LSO4vL/R+mQFnFKj/Ogkg32DTyAxEhi Nof9/c7uz/lg7hRO4kX1xO6SVQxmIqWefHTMEy5TKucJjsrKhLhs+rhYqepmVXA8gaff lZEg8Kp7AcyGEHaKLe6N9BLSzdCCa89lMarGh2+wiqqW5Z3Bx6WZ4cNKDHN3UqPwsOKQ FJUovjH2dakGWIqp3YsdxwGjjEtOXWTRIOukp89JdBiKJWZ81DYRkta2xFciSDxf3Mim HUkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=pkrlOPfU; spf=pass (google.com: domain of linux-kernel+bounces-13351-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13351-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y15-20020a17090629cf00b00a2374077f8bsi7924824eje.586.2023.12.29.23.20.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 23:20:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13351-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=pkrlOPfU; spf=pass (google.com: domain of linux-kernel+bounces-13351-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13351-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 04F631F21788 for ; Sat, 30 Dec 2023 07:20:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E0621FC5; Sat, 30 Dec 2023 07:20:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="pkrlOPfU" X-Original-To: linux-kernel@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26F6B23A0; Sat, 30 Dec 2023 07:20:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1703920806; bh=J7zOLrgUhExML8R0Y0YXOb52VWcQiWm+mjBPwA42lC0=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=pkrlOPfUh4fMJt+EULtNRS8qbjRQckMVGac7yorbHmb8QoF5rhDQ2H/or2ksNqA2Y mM/IPm2hoFegs5xc4OWpu+dxARFziwtOU1XdwV7Pc/8C53JorFfxyBjehNMi+l8Zy0 6+aakTAnFuNE+DztuaNS9dxqTf410CcIAc4KtLDONAZBHDe8L3sL+HuX8R1T4G8e0b Zzxka2S6vC2XQbd1r5ZoejeCClAMr64wqypsvLn10hmqgC2irRwwpljjR0smvAN4tJ n6roiaxv36bzrLIGnHKQ9P5AVLS4tBZrruXGlCzyrqRAi6Pkco3xx94KxjHe4izi4z 9g2Wq+YWttGPw== Received: from [100.96.234.34] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 4837D37811F1; Sat, 30 Dec 2023 07:20:03 +0000 (UTC) Message-ID: <36eac3a4-bca9-4648-9154-7a0561476f9f@collabora.com> Date: Sat, 30 Dec 2023 12:20:03 +0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: Muhammad Usama Anjum , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: Re: [PATCH] kunit: Fix NULL-dereference in kunit_init_suite() if suite->log is NULL Content-Language: en-US To: Richard Fitzgerald , brendan.higgins@linux.dev, davidgow@google.com, rmoar@google.com References: <20231218151729.210027-1-rf@opensource.cirrus.com> From: Muhammad Usama Anjum In-Reply-To: <20231218151729.210027-1-rf@opensource.cirrus.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 12/18/23 8:17 PM, 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") Reviewed-by: Muhammad Usama Anjum > --- > 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) -- BR, Muhammad Usama Anjum