mirror of
https://git.freebsd.org/ports.git
synced 2025-06-09 23:00:30 -04:00
sysutils/acpi_call: Check for errors from copyout()
The base system will soon require all copyout() calls to either preserve the return value or explicitly ignore it. PR: 275986 Approved by: antoine
This commit is contained in:
parent
c9d519a603
commit
d0d5a75f66
2 changed files with 9 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
PORTNAME= acpi_call
|
PORTNAME= acpi_call
|
||||||
PORTVERSION= 1.0.1
|
PORTVERSION= 1.0.1
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
CATEGORIES= sysutils
|
CATEGORIES= sysutils
|
||||||
MASTER_SITES= http://projects.ukrweb.net/files/ \
|
MASTER_SITES= http://projects.ukrweb.net/files/ \
|
||||||
http://imax.in.ua/files/
|
http://imax.in.ua/files/
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#if __FreeBSD__ >= 8
|
#if __FreeBSD__ >= 8
|
||||||
# include <contrib/dev/acpica/include/acpi.h>
|
# include <contrib/dev/acpica/include/acpi.h>
|
||||||
@@ -45,18 +45,97 @@
|
@@ -45,18 +45,99 @@ void acpi_call_fixup_pointers(ACPI_OBJECT *p, UINT8 *o
|
||||||
|
|
||||||
void acpi_call_fixup_pointers(ACPI_OBJECT *p, UINT8 *orig);
|
void acpi_call_fixup_pointers(ACPI_OBJECT *p, UINT8 *orig);
|
||||||
|
|
||||||
|
@ -95,7 +95,9 @@
|
||||||
+ ACPI_OBJECT_LIST *args;
|
+ ACPI_OBJECT_LIST *args;
|
||||||
ACPI_BUFFER result;
|
ACPI_BUFFER result;
|
||||||
+ char path[256];
|
+ char path[256];
|
||||||
|
+ int error;
|
||||||
|
|
||||||
|
+ error = 0;
|
||||||
result.Length = ACPI_ALLOCATE_BUFFER;
|
result.Length = ACPI_ALLOCATE_BUFFER;
|
||||||
result.Pointer = NULL;
|
result.Pointer = NULL;
|
||||||
|
|
||||||
|
@ -111,13 +113,14 @@
|
||||||
if (ACPI_SUCCESS(params->retval))
|
if (ACPI_SUCCESS(params->retval))
|
||||||
{
|
{
|
||||||
if (result.Pointer != NULL)
|
if (result.Pointer != NULL)
|
||||||
@@ -64,30 +143,31 @@ acpi_call_ioctl(u_long cmd, caddr_t addr, void *arg)
|
@@ -64,30 +145,31 @@ acpi_call_ioctl(u_long cmd, caddr_t addr, void *arg)
|
||||||
if (params->result.Pointer != NULL)
|
if (params->result.Pointer != NULL)
|
||||||
{
|
{
|
||||||
params->result.Length = min(params->result.Length, result.Length);
|
params->result.Length = min(params->result.Length, result.Length);
|
||||||
|
- copyout(result.Pointer, params->result.Pointer,
|
||||||
+ if (result.Length >= sizeof(ACPI_OBJECT))
|
+ if (result.Length >= sizeof(ACPI_OBJECT))
|
||||||
+ acpi_call_fixup_pointers((ACPI_OBJECT*)result.Pointer, params->result.Pointer);
|
+ acpi_call_fixup_pointers((ACPI_OBJECT*)result.Pointer, params->result.Pointer);
|
||||||
copyout(result.Pointer, params->result.Pointer,
|
+ error = copyout(result.Pointer, params->result.Pointer,
|
||||||
params->result.Length);
|
params->result.Length);
|
||||||
params->reslen = result.Length;
|
params->reslen = result.Length;
|
||||||
- if (result.Length >= sizeof(ACPI_OBJECT))
|
- if (result.Length >= sizeof(ACPI_OBJECT))
|
||||||
|
@ -129,7 +132,8 @@
|
||||||
+ free_acpi_object_list(args);
|
+ free_acpi_object_list(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
- return (0);
|
||||||
|
+ return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Reference in a new issue