public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lv.zheng@intel.com
Cc: linux-acpi@vger.kernel.org
Subject: re: ACPICA: ACPI 2.0, Interpreter: Fix MLC issues by switching to new TermList grammar for table loading
Date: Sat, 4 Jun 2016 17:04:15 +0300	[thread overview]
Message-ID: <20160604140415.GA3344@mwanda> (raw)

Hello Lv Zheng,

The patch 0bfd2f1ec274: "ACPICA: ACPI 2.0, Interpreter: Fix MLC
issues by switching to new TermList grammar for table loading" from
May 13, 2016, leads to the following static checker warning:

	drivers/acpi/acpica/nsparse.c:139 acpi_ns_execute_table()
	error: we previously assumed 'info' could be null (see line 110)

drivers/acpi/acpica/nsparse.c
   135          (void)acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
   136  
   137  cleanup:
   138          acpi_ut_remove_reference(method_obj);
   139          ACPI_FREE(info->full_pathname);
                          ^^^^^^^^^^^^^^^^^^^
Archetypal one err bug.  It's better to unwind in reverse order from how
you allacted things and only free things you have allocated.  Use more
than one label.  Also you can use more descriptive label names.

	(void)acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);

free_pathname:
	ACPI_FREE(info->full_pathname);
free_info:
	ACPI_FREE(info);
remove_method:
	acpi_ut_remove_reference(method_obj);

	return_ACPI_STATUS(status);


   140          info->full_pathname = NULL;
   141          ACPI_FREE(info);
   142          return_ACPI_STATUS(status);
   143  }

regards,
dan carpenter

             reply	other threads:[~2016-06-04 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04 14:04 Dan Carpenter [this message]
2016-06-06 10:05 ` ACPICA: ACPI 2.0, Interpreter: Fix MLC issues by switching to new TermList grammar for table loading Zheng, Lv
2016-06-06 10:24   ` Dan Carpenter
2016-06-06 10:26 ` [PATCH] ACPICA: Namespace: Fix wrong cleanup code in acpi_ns_execute_table() Lv Zheng

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=20160604140415.GA3344@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=lv.zheng@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