Browse Source

acpi: accomodate null pointers in ApciOsGetLine

This is not documented in the ACPICA spec but the
returned pointer to bytes read can be nil.

Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Ronald G. Minnich 7 years ago
parent
commit
4e36db175e
1 changed files with 4 additions and 1 deletions
  1. 4 1
      sys/src/libacpi/harvey.c

+ 4 - 1
sys/src/libacpi/harvey.c

@@ -659,9 +659,12 @@ AcpiOsPhysicalTableOverride(ACPI_TABLE_HEADER * ExistingTable,
 ACPI_STATUS
 AcpiOsGetLine(char *Buffer, UINT32 BufferLength, UINT32 * BytesRead)
 {
+	int amt;
 	if (debug)
 		fprint(2, "%s\n", __func__);
-	*BytesRead = read(0, Buffer, BufferLength);
+	amt = read(0, Buffer, BufferLength);
+	if (BytesRead)
+		*BytesRead = amt;
 	return AE_OK;
 }