Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp179388rdb; Tue, 19 Dec 2023 13:03:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcqJmqX5w6C7XwOslc3gKxmo1xDcD4za6noFfEWz795VFrDFOIPU8IP7En9ZG55w0CziRT X-Received: by 2002:a17:906:608:b0:a19:a19b:788b with SMTP id s8-20020a170906060800b00a19a19b788bmr8990681ejb.78.1703019837308; Tue, 19 Dec 2023 13:03:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703019837; cv=none; d=google.com; s=arc-20160816; b=LerAJgTpVVJk7BzU114M3vFk1JA+mm/plfj/Dt9PZr8XNN73xKup5pjTW2bJ15ftr5 M1YjdyEkoju9lvAPZE6nC0IVF6+6FRDz68MW9Ewz5BG1Vhk0VpET5NjbX3G4bNhA+WI9 D5aTVNoYqdmTLDW8gkwzZJn44N9DAyQHwumtD8CRYJpauMw7WgOLoidyzGJ1vpOByPxm M0V70mMm0cX3B/GGH4LZ6SbpeCFpD1PDCusYWxVJEJQ6xBuXA0Ac4duJTONZyUDqnhPb IOUzWxfq7OTnDzK0R98+JyKypE1lhZKJ08C6Xy4nMgiyFZA/Vt8+S4UIaLLYMV+/4/er Tfmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=cPrvLQ9nSKbJaWthUQcTRxDkRs0WKc5wjPuSEHtrSQU=; fh=VgtnJUKslQWC1J4hSraUCaGGwBrlwsv9kzwfY7I3kHA=; b=li3jAa//v4tD4+6qj9/MTtf2O15PMO7h7gtpxujmXanzqaO191cf+6jCT2AtEEmc54 cqXqjOK1pUXwd4P7kx51+/eaCfzWD/Pbh3TnCjSlcQqUpOGZ/R+4xRc2gpuJk+GmmOmH u3F/2sx48kcl6DMnLJ89pKbN3/JFh1SfFGr3Ypjt8RxUH0le2MWY83PPWCnh8n+lxmid U/f+JFrFzlZedrMF3MY/JJ5ev+3dTD5hLs6+nK+eXB+K10qNEjVj3G2x1/F5+rLsMUFq 9E/k1gvmMJi4WtuiUp9nqRJQxuq5uiB8Tak+udMbH0nMEazowheb7jOfbLh7y6igM/5Q ZsnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=bIimDqd1; spf=pass (google.com: domain of linux-kernel+bounces-5949-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5949-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. [147.75.80.249]) by mx.google.com with ESMTPS id jp23-20020a170906f75700b00a2359f42329si1982290ejb.472.2023.12.19.13.03.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 13:03:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5949-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=@google.com header.s=20230601 header.b=bIimDqd1; spf=pass (google.com: domain of linux-kernel+bounces-5949-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5949-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 15D371F237E8 for ; Tue, 19 Dec 2023 21:03:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FC9E3A1B9; Tue, 19 Dec 2023 21:03:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bIimDqd1" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 DEEBD3D0A5 for ; Tue, 19 Dec 2023 21:03:47 +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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-40c3963f9fcso1045e9.1 for ; Tue, 19 Dec 2023 13:03:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703019826; x=1703624626; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cPrvLQ9nSKbJaWthUQcTRxDkRs0WKc5wjPuSEHtrSQU=; b=bIimDqd10RwEYvM9QoCk2rqaL3wQIdapP2ZHHCZE9cyCRns7JkyNRbTDibQMqm+xFj z/T/Z1LzfVz3Vfznjn93gWC36dujDyqhyri3yL68eVVYRVt5Iklg+9Xmf4A2az/KMr0Z vsL99WFj16MozYaSUAgGHuAV8fomq1tw4KP+M5qfOJJB5ZQOlojimn9xVgsJlzMil2yj +8CJ3xNd/Kb1b6cvlq4h0kd/rg2fZutXgQcCUl1x7iTl30FFT51D9GQMGG+UK1ho1bFY cwH25KRLEXQljsnzGFlzZcTh7BjyILs3UBI40yP3BdtWoEsf+EbqvI2CfWSKr8MV4ige pYzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703019826; x=1703624626; h=content-transfer-encoding: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=cPrvLQ9nSKbJaWthUQcTRxDkRs0WKc5wjPuSEHtrSQU=; b=xFAXKdMDu5l2MDSXywoMAIORx9Jk6q4qsQ5uBtwkuh7pjwHr5N1zsDnDc3piVZgCI2 zl/i5WY1VeLY160tXof7aunm4uGEbj8fEw18I/mrP1NwHYQgITh2/gHV8HDFK8xJ5TaQ xBDnjRmUKIVcb41Xryaod8XsgopYryGr7aXZofjWs3PEfJuEu2Uhxxat2uPuB8iLz74W zvFs6VlOrSNCJ4Oqz6zHVS7vY3bRVLSP8ybwWmJsp/RJoZpto2zmoU/Lq4DwJhMR4O6j vZ6mke4CL4Ez9Mck24r0cVnRddMbPX3Aa/EHXtxnplav+9egPAD5SlBf5imriXAVD0B3 AbBQ== X-Gm-Message-State: AOJu0Yzsk8uCcmkI2+AEls65yndcdxZMWej6IQ/oQeODQ/2jq3L+mo5K SinvRpWFAFcf4l4vR7usWxMLTeMxljDjusyP7YjWhosdeYSs X-Received: by 2002:a7b:c8c6:0:b0:40b:5972:f56b with SMTP id f6-20020a7bc8c6000000b0040b5972f56bmr6502wml.3.1703019825979; Tue, 19 Dec 2023 13:03:45 -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: Rae Moar Date: Tue, 19 Dec 2023 16:03:34 -0500 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, davidgow@google.com, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 18, 2023 at 10:17=E2=80=AFAM 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 de= bugfs") Hello! This looks good! Thanks! Sorry I did not catch this earlier. Reviewed-by: Rae Moar -Rae > --- > 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 *suit= e) > kunit_debugfs_create_suite(suite); > suite->status_comment[0] =3D '\0'; > suite->suite_init_err =3D 0; > - string_stream_clear(suite->log); > + > + if (suite->log) > + string_stream_clear(suite->log); > } > > bool kunit_enabled(void) > -- > 2.30.2 >