Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: zhangjiao2 <zhangjiao2@cmss.chinamobile.com>, skhan@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	mingo@redhat.com, shuah@kernel.org,
	zhang jiao <zhangjiao2@cmss.chinamobile.com>
Subject: Re: [PATCH v3] selftests: futex: Fix missing free in main
Date: Fri, 06 Sep 2024 16:17:07 +0200	[thread overview]
Message-ID: <87ed5weujg.ffs@tglx> (raw)
In-Reply-To: <20240906021918.3125-1-zhangjiao2@cmss.chinamobile.com>

On Fri, Sep 06 2024 at 10:19, zhangjiao2@cmss.chinamobile.com wrote:
> @@ -362,6 +363,7 @@ int main(int argc, char *argv[])
>  {
>  	char *test_name;
>  	int c, ret;
> +	bool is_static = false;

what means is_static? It's not connected to test_name in any way and
please use reverse fir tree variable ordering

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#variable-declarations

So either use a variable name which makes it clear that it is related to
test_name (something obvious like: name_allocated) or do

       char *test_name, *default_name = TEST_NAME;

and do test_name = default_name; in the error path and then check for

    (test_name != default_name)

Whatever you pick will be better than the non-obvious is_static.

Thanks,

        tglx

      reply	other threads:[~2024-09-06 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  2:19 [PATCH v3] selftests: futex: Fix missing free in main zhangjiao2
2024-09-06 14:17 ` Thomas Gleixner [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=87ed5weujg.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=zhangjiao2@cmss.chinamobile.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