Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <dan.j.williams@intel.com>, vishal.l.verma@intel.com
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Subject: Re: [PATCH 4/4] test: Fix dangling pointer warning
Date: Fri, 28 Apr 2023 09:06:56 -0700	[thread overview]
Message-ID: <20661e33-3fa5-ef03-0860-fa20f540a3f6@intel.com> (raw)
In-Reply-To: <168236639399.1027628.5866455518934998684.stgit@dwillia2-xfh.jf.intel.com>



On 4/24/23 12:59 PM, Dan Williams wrote:
> gcc (13.0.1 20230421 (Red Hat 13.0.1-0)) complains:
> 
> ../test/libndctl.c: In function ‘check_commands’:
> ../test/libndctl.c:2313:20: warning: storing the address of local variable
> ‘__check_dimm_cmds’ in ‘check_cmds’ [-Wdangling-poiter=]
> 
> ...fix it by showing the compiler that the local setting does not escape
> the function.
> 
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   test/libndctl.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/test/libndctl.c b/test/libndctl.c
> index 51245cf4ea98..858110c4dbc1 100644
> --- a/test/libndctl.c
> +++ b/test/libndctl.c
> @@ -2322,7 +2322,8 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
>   					ndctl_bus_get_provider(bus),
>   					ndctl_dimm_get_id(dimm),
>   					ndctl_dimm_get_cmd_name(dimm, i));
> -			return -ENXIO;
> +			rc = -ENXIO;
> +			break;
>   		}
>   
>   		if (!check->check_fn)
> @@ -2331,6 +2332,7 @@ static int check_commands(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
>   		if (rc)
>   			break;
>   	}
> +	check_cmds = NULL;
>   
>   	for (i = 0; i < ARRAY_SIZE(__check_dimm_cmds); i++) {
>   		if (__check_dimm_cmds[i].cmd)
> 
> 

      reply	other threads:[~2023-04-28 16:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-24 19:59 [ndctl PATCH 0/4] cxl list and test fixes Dan Williams
2023-04-24 19:59 ` [PATCH 1/4] cxl/list: Fix filtering RCDs Dan Williams
2023-04-28 15:54   ` Dave Jiang
2023-04-24 19:59 ` [PATCH 2/4] cxl/list: Filter root decoders by region Dan Williams
2023-04-28 16:03   ` Dave Jiang
2023-04-24 19:59 ` [PATCH 3/4] test: Support test modules located in 'updates' instead of 'extra' Dan Williams
2023-04-28 16:05   ` Dave Jiang
2023-04-24 19:59 ` [PATCH 4/4] test: Fix dangling pointer warning Dan Williams
2023-04-28 16:06   ` Dave Jiang [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=20661e33-3fa5-ef03-0860-fa20f540a3f6@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.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