mirror of
https://github.com/ipxe/ipxe
synced 2025-12-07 18:00:28 +03:00
[peerdist] Remove userptr_t from PeerDist content information parsing
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -11,7 +11,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <stdint.h>
|
||||
#include <byteswap.h>
|
||||
#include <ipxe/uaccess.h>
|
||||
#include <ipxe/crypto.h>
|
||||
|
||||
/******************************************************************************
|
||||
@@ -300,7 +299,7 @@ struct peerdist_info_v2_segment {
|
||||
/** Raw content information */
|
||||
struct peerdist_raw {
|
||||
/** Data buffer */
|
||||
userptr_t data;
|
||||
const void *data;
|
||||
/** Length of data buffer */
|
||||
size_t len;
|
||||
};
|
||||
@@ -435,7 +434,7 @@ struct peerdist_info_operations {
|
||||
|
||||
extern struct digest_algorithm sha512_trunc_algorithm;
|
||||
|
||||
extern int peerdist_info ( userptr_t data, size_t len,
|
||||
extern int peerdist_info ( const void *data, size_t len,
|
||||
struct peerdist_info *info );
|
||||
extern int peerdist_info_segment ( const struct peerdist_info *info,
|
||||
struct peerdist_info_segment *segment,
|
||||
|
||||
@@ -88,7 +88,7 @@ static int peerdist_info_get ( const struct peerdist_info *info, void *data,
|
||||
}
|
||||
|
||||
/* Copy data */
|
||||
copy_from_user ( data, info->raw.data, offset, len );
|
||||
memcpy ( data, ( info->raw.data + offset ), len );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -667,7 +667,8 @@ static struct peerdist_info_operations peerdist_info_v2_operations = {
|
||||
* @v info Content information to fill in
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int peerdist_info ( userptr_t data, size_t len, struct peerdist_info *info ) {
|
||||
int peerdist_info ( const void *data, size_t len,
|
||||
struct peerdist_info *info ) {
|
||||
union peerdist_info_version version;
|
||||
int rc;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <ipxe/uaccess.h>
|
||||
#include <ipxe/pccrc.h>
|
||||
#include <ipxe/sha256.h>
|
||||
#include <ipxe/sha512.h>
|
||||
@@ -362,11 +361,10 @@ static void peerdist_info_okx ( struct peerdist_info_test *test,
|
||||
const char *file, unsigned int line ) {
|
||||
|
||||
/* Parse content information */
|
||||
okx ( peerdist_info ( virt_to_user ( test->data ), test->len,
|
||||
info ) == 0, file, line );
|
||||
okx ( peerdist_info ( test->data, test->len, info ) == 0, file, line );
|
||||
|
||||
/* Verify content information */
|
||||
okx ( info->raw.data == virt_to_user ( test->data ), file, line );
|
||||
okx ( info->raw.data == test->data, file, line );
|
||||
okx ( info->raw.len == test->len, file, line );
|
||||
okx ( info->digest == test->expected_digest, file, line );
|
||||
okx ( info->digestsize == test->expected_digestsize, file, line );
|
||||
|
||||
Reference in New Issue
Block a user