From: Shuah Khan <skhan@linuxfoundation.org>
To: Guo Zhengkui <guozhengkui@vivo.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: zhengkui_guo@outlook.com, Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH linux-next] selftests/vDSO: fix array_size.cocci warning
Date: Tue, 22 Mar 2022 17:01:01 -0600 [thread overview]
Message-ID: <489c8759-27c6-c71f-987d-3fc6d255f3b8@linuxfoundation.org> (raw)
In-Reply-To: <20220321052757.10918-1-guozhengkui@vivo.com>
On 3/20/22 11:27 PM, Guo Zhengkui wrote:
> Fix the following coccicheck warning:
>
> tools/testing/selftests/vDSO/vdso_test_correctness.c:309:46-47:
> WARNING: Use ARRAY_SIZE
> tools/testing/selftests/vDSO/vdso_test_correctness.c:373:46-47:
> WARNING: Use ARRAY_SIZE
>
> It has been tested with gcc (Debian 8.3.0-6) 8.3.0 on x86_64.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
> tools/testing/selftests/vDSO/vdso_test_correctness.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/vDSO/vdso_test_correctness.c b/tools/testing/selftests/vDSO/vdso_test_correctness.c
> index c4aea794725a..e691a3cf1491 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_correctness.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_correctness.c
> @@ -20,6 +20,7 @@
> #include <limits.h>
>
> #include "vdso_config.h"
> +#include "../kselftest.h"
>
> static const char **name;
>
> @@ -306,10 +307,8 @@ static void test_clock_gettime(void)
> return;
> }
>
> - for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
> - clock++) {
> + for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
> test_one_clock_gettime(clock, clocknames[clock]);
> - }
>
> /* Also test some invalid clock ids */
> test_one_clock_gettime(-1, "invalid");
> @@ -370,10 +369,8 @@ static void test_clock_gettime64(void)
> return;
> }
>
> - for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]);
> - clock++) {
> + for (int clock = 0; clock < ARRAY_SIZE(clocknames); clock++)
> test_one_clock_gettime64(clock, clocknames[clock]);
> - }
>
> /* Also test some invalid clock ids */
> test_one_clock_gettime64(-1, "invalid");
>
Looks good to me. I will apply this once merge window closes.
thanks,
-- Shuah
prev parent reply other threads:[~2022-03-22 23:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-21 5:27 Guo Zhengkui
2022-03-22 23:01 ` Shuah Khan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=489c8759-27c6-c71f-987d-3fc6d255f3b8@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=guozhengkui@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=zhengkui_guo@outlook.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®