From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) (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 DF8D417FAC2 for ; Thu, 14 Nov 2024 16:25:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731601513; cv=none; b=RrWXER1YGiP23zOc9ko6g1mJkHVvDAZM8sPrFBt7S9sgfw5KRVZd8DP0FT4xop5K3/kIeaI1G7Bsg+xBVLQ7xAYxad46jAMz6viB7LUr6zyrSVs1OjRquCTxrRYl5hStmhJtUCUgH0jzbMApXnu/uSoMIPX/x882ZMZiIwWN8Lo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731601513; c=relaxed/simple; bh=6Ha7uxNaK+n9PEyKhZrLgUrNGlLriEL3O6jXb4Jz4qo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hkK/ruwFXObW3RdQbVpSp89BuWNJQmJmYoBIwkxUAQJmikpwCb4uSHyuHfRdc8rp/MPesZ5AlvJYKOB+Jes7RN9NLhUPjBr93apcW6JlKZPtwa1QJMGq2zHBxL+a8pDdoRlM81J2jfEgJGEejsrPdL/9nMWSmtipQnpFRO75QK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BlJ2hNXP; arc=none smtp.client-ip=209.85.166.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="BlJ2hNXP" Received: by mail-io1-f51.google.com with SMTP id ca18e2360f4ac-83e5dd0e5faso29130039f.1 for ; Thu, 14 Nov 2024 08:25:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1731601511; x=1732206311; darn=lists.linux.dev; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=buo6iWrbAJctceKC3COg5WA7QA2TRFr7kULc06jQepM=; b=BlJ2hNXPMckMFLlC2jaIYMZKr/SdN6BuftYmhyL6urPcy6qVUsloA4Jy8b4eeYvjdw Lb8C+GHa+IoFFf3WEejthn/tTox+RRDdC+Aqf7I3+PzKjv1TyQqjUxitxAdBLYjZnhOc DR2HjPIp7SMeC9HtTfbqBMyijqj80isF7zPH4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731601511; x=1732206311; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=buo6iWrbAJctceKC3COg5WA7QA2TRFr7kULc06jQepM=; b=RDD2sscH3wfN5hdYHaUkoTIm7ViHGxkI/ZuynUxE5xzo1BwizVDkoOF1atA4FtRD1f YNX7NSDhhsNQYbgdC2MCyBvvVbjBOTWMKDbR+uodZBJlcaWDMqgxsv63D7I7Sdfhx8z+ yg1OwUgGpKzFWC+3/p/mnWDquoGgM3bsH432F3sBLKMD027UL64mT6ktzj8qYywg/n4P ROdz4bTHD3mRi/GWXk3aRMXhjOEjGu1XC8l5BsjoSQcodOZJIfplnqeyxQiikEF+teLD dPpE51Jc2aqRMXgbr4p2jZo7PXZ8d7+3/842BBno2oqhL66htno55qBVQS/9GhhX1Xin Apkw== X-Forwarded-Encrypted: i=1; AJvYcCWBk42OgB5Cq7XHetdc+0IMGw9YKwXNUtpNlV/ReHKovCQk7EXhea0qPbgykI/5uSkzerEvKipA+KtlWkK4qCd16mjZbA==@lists.linux.dev X-Gm-Message-State: AOJu0Ywl4ywBuFu1lpB+6erFHcOOC1YswkTRUE3av+1M52xi9JGPTHQx HGFMpjpsTh/WrWA2cXBpJNj6puwth0//gfkB6qnlXtj1SLwMKOUDWMSi7/cqVBE= X-Google-Smtp-Source: AGHT+IGrmfnV9irE2RmqR2nu682ZNoHCBmmsGPW80Shl2133F6qXCefXE/lr40u4emN9zp5hCGdmsA== X-Received: by 2002:a05:6602:2cd2:b0:83b:5306:d24d with SMTP id ca18e2360f4ac-83e5cd3f503mr373740939f.6.1731601510897; Thu, 14 Nov 2024 08:25:10 -0800 (PST) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-83e6064446esm33821439f.48.2024.11.14.08.25.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Nov 2024 08:25:10 -0800 (PST) Message-ID: <52cc8e51-9e85-465b-8ee3-63a7a0a42951@linuxfoundation.org> Date: Thu, 14 Nov 2024 09:25:09 -0700 Precedence: bulk X-Mailing-List: linux-kernel-mentees@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests: lsm: Refactor `flags_overset_lsm_set_self_attr` test To: Amit Vadhavana , paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, casey@schaufler-ca.com, shuah@kernel.org Cc: ricardo@marliere.net, linux-kernel-mentees@lists.linux.dev, linux-security-module@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <20241112182810.24761-1-av2082000@gmail.com> Content-Language: en-US From: Shuah Khan In-Reply-To: <20241112182810.24761-1-av2082000@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/12/24 11:28, Amit Vadhavana wrote: > - Remove unnecessary `tctx` variable, use `ctx` directly. > - Simplified code with no functional changes. > I would rephrase the short to simply say Remove unused variable, as refactor implies more extensive changes than what this patch is actually doing. Please write complete sentences instead of bullet points in the change log. How did you find this problem? Do include the details on how in the change log. > Signed-off-by: Amit Vadhavana > --- > tools/testing/selftests/lsm/lsm_set_self_attr_test.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c > index 66dec47e3ca3..732e89fe99c0 100644 > --- a/tools/testing/selftests/lsm/lsm_set_self_attr_test.c > +++ b/tools/testing/selftests/lsm/lsm_set_self_attr_test.c > @@ -56,16 +56,15 @@ TEST(flags_zero_lsm_set_self_attr) > TEST(flags_overset_lsm_set_self_attr) > { > const long page_size = sysconf(_SC_PAGESIZE); > - char *ctx = calloc(page_size, 1); > + struct lsm_ctx *ctx = calloc(page_size, 1); Why not name this tctx and avoid changes to the ASSERT_EQs below? > __u32 size = page_size; > - struct lsm_ctx *tctx = (struct lsm_ctx *)ctx; > > ASSERT_NE(NULL, ctx); > if (attr_lsm_count()) { > - ASSERT_LE(1, lsm_get_self_attr(LSM_ATTR_CURRENT, tctx, &size, > + ASSERT_LE(1, lsm_get_self_attr(LSM_ATTR_CURRENT, ctx, &size, > 0)); > } > - ASSERT_EQ(-1, lsm_set_self_attr(LSM_ATTR_CURRENT | LSM_ATTR_PREV, tctx, > + ASSERT_EQ(-1, lsm_set_self_attr(LSM_ATTR_CURRENT | LSM_ATTR_PREV, ctx, > size, 0)); > > free(ctx); You have to change this tctx for sure. With these changes: Reviewed-by: Shuah Khan Paul, James, Please do let me know if you would me to take this through kselftest tree. thanks, -- Shuah