Re: [PATCH] tools/testing/nvdimm: Remove NULL test before vfree

From: Alison Schofield
Date: Fri Jun 25 2021 - 21:46:43 EST


On Fri, Jun 25, 2021 at 06:26:55PM -0700, 13145886936@xxxxxxx wrote:
> From: gushengxian <gushengxian@xxxxxxxxxx>

Hi,

Thanks for updating the commit message and log.

I think you need to do something about the Signed-off-by or this
will not be accepted. You can read more about the developer's
certificate of origin in here.
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Not sure your particular case, but maybe -

If you are submitting this on behalf of Gushengxian, then you need
to add your Signed-off-by after the current one:
ie. Signed-off-by: Your Full Name <13145886936@xxxxxxx>

Or, if this is your work, then you may need to update your
.gitconfig file, like this:

[user]
name = Your Full Name
email = email@xxxxxxxxxxx

The From line of the email needs to match a Signed-off-by.

Each time you repost a patch please increment the version number.
The next posting would be [PATCH v3]

Alison

>
> This NULL test is redundant since vfree() checks for NULL.
> Reported by Coccinelle.
>
> Signed-off-by: gushengxian <gushengxian@xxxxxxxxxx>
> ---
> tools/testing/nvdimm/test/nfit.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
> index 54f367cbadae..cb86f0cbb11c 100644
> --- a/tools/testing/nvdimm/test/nfit.c
> +++ b/tools/testing/nvdimm/test/nfit.c
> @@ -1641,8 +1641,8 @@ static void *__test_alloc(struct nfit_test *t, size_t size, dma_addr_t *dma,
> err:
> if (*dma && size >= DIMM_SIZE)
> gen_pool_free(nfit_pool, *dma, size);
> - if (buf)
> - vfree(buf);
> +
> + vfree(buf);
> kfree(nfit_res);
> return NULL;
> }
> --
> 2.25.1
>
>