linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: ACPICA: Linuxize: Export debugger files to Linux
@ 2015-11-03 14:25 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-11-03 14:25 UTC (permalink / raw)
  To: lv.zheng; +Cc: linux-acpi

Hello Lv Zheng,

This is a semi-automatic email about new static checker warnings.

The patch 995751025572: "ACPICA: Linuxize: Export debugger files to 
Linux" from Oct 19, 2015, leads to the following Smatch complaint:

drivers/acpi/acpica/dbcmds.c:1159 acpi_db_trace()
	 error: we previously assumed 'enable_arg' could be null (see line 1134)

drivers/acpi/acpica/dbcmds.c
  1133	
  1134		if (enable_arg) {
                    ^^^^^^^^^^
Check for NULL.

  1135			acpi_ut_strupr(enable_arg);
  1136		}
  1137	
  1138		if (once_arg) {
  1139			acpi_ut_strupr(once_arg);
  1140		}
  1141	
  1142		if (method_arg) {
  1143			if (acpi_db_trace_method_name) {
  1144				ACPI_FREE(acpi_db_trace_method_name);
  1145				acpi_db_trace_method_name = NULL;
  1146			}
  1147	
  1148			acpi_db_trace_method_name =
  1149			    ACPI_ALLOCATE(strlen(method_arg) + 1);
  1150			if (!acpi_db_trace_method_name) {
  1151				acpi_os_printf("Failed to allocate method name (%s)\n",
  1152					       method_arg);
  1153				return;
  1154			}
  1155	
  1156			strcpy(acpi_db_trace_method_name, method_arg);
  1157		}
  1158	
  1159		if (!strcmp(enable_arg, "ENABLE") ||
                            ^^^^^^^^^^
Unchecked dereferences.

  1160		    !strcmp(enable_arg, "METHOD") || !strcmp(enable_arg, "OPCODE")) {
  1161			if (!strcmp(enable_arg, "ENABLE")) {

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* re: ACPICA: Linuxize: Export debugger files to Linux
@ 2015-11-03 14:25 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-11-03 14:25 UTC (permalink / raw)
  To: lv.zheng; +Cc: linux-acpi

Hello Lv Zheng,

This is a semi-automatic email about new static checker warnings.

The patch 995751025572: "ACPICA: Linuxize: Export debugger files to 
Linux" from Oct 19, 2015, leads to the following Smatch complaint:

drivers/acpi/acpica/dbxface.c:298 acpi_db_single_step()
	 error: we previously assumed 'walk_state->control_state' could be null (see line 252)

drivers/acpi/acpica/dbxface.c
   251			if (parent_op) {
   252				if ((walk_state->control_state) &&
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
Checked.

   253				    (walk_state->control_state->common.state ==
   254				     ACPI_CONTROL_PREDICATE_EXECUTING)) {
   255					/*
   256					 * We are executing the predicate of an IF or WHILE statement
   257					 * Search upwards for the containing IF or WHILE so that the
   258					 * entire predicate can be displayed.
   259					 */
   260					while (parent_op) {
   261						if ((parent_op->common.aml_opcode ==
   262						     AML_IF_OP)
   263						    || (parent_op->common.aml_opcode ==
   264							AML_WHILE_OP)) {
   265							display_op = parent_op;
   266							break;
   267						}
   268						parent_op = parent_op->common.parent;
   269					}
   270				} else {
   271					while (parent_op) {
   272						if ((parent_op->common.aml_opcode ==
   273						     AML_IF_OP)
   274						    || (parent_op->common.aml_opcode ==
   275							AML_ELSE_OP)
   276						    || (parent_op->common.aml_opcode ==
   277							AML_SCOPE_OP)
   278						    || (parent_op->common.aml_opcode ==
   279							AML_METHOD_OP)
   280						    || (parent_op->common.aml_opcode ==
   281							AML_WHILE_OP)) {
   282							break;
   283						}
   284						display_op = parent_op;
   285						parent_op = parent_op->common.parent;
   286					}
   287				}
   288			}
   289	
   290			/* Now we can display it */
   291	
   292	#ifdef ACPI_DISASSEMBLER
   293			acpi_dm_disassemble(walk_state, display_op, ACPI_UINT32_MAX);
   294	#endif
   295	
   296			if ((op->common.aml_opcode == AML_IF_OP) ||
   297			    (op->common.aml_opcode == AML_WHILE_OP)) {
   298				if (walk_state->control_state->common.value) {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Not checked.

   299					acpi_os_printf
   300					    ("Predicate = [True], IF block was executed\n");

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-03 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-03 14:25 ACPICA: Linuxize: Export debugger files to Linux Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2015-11-03 14:25 Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).