dprintf: remove redondant user address check.

check user_memcpy success.
This commit is contained in:
Jérôme Duval 2018-01-16 20:54:44 +01:00
parent 181bcc8c78
commit 8d794763d5

View File

@ -11,7 +11,6 @@
#include <debug.h>
#include <kernel.h>
#include <Drivers.h>
#include <KernelExport.h>
@ -71,8 +70,6 @@ dprintf_read(void *cookie, off_t pos, void *buffer, size_t *length)
static status_t
dprintf_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
{
if (!IS_USER_ADDRESS(buffer))
return B_BAD_ADDRESS;
const char *str = (const char*)buffer;
int bytesLeft = *_length;
@ -100,7 +97,8 @@ dprintf_write(void *cookie, off_t pos, const void *buffer, size_t *_length)
char localBuffer[512];
if (bytesLeft > (int)sizeof(localBuffer) - 1)
chunkSize = (int)sizeof(localBuffer) - 1;
user_memcpy(localBuffer, str, chunkSize);
if (user_memcpy(localBuffer, str, chunkSize) < B_OK)
return B_BAD_ADDRESS;
localBuffer[chunkSize] = '\0';
debug_puts(localBuffer, chunkSize);