[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 04/24] xen: guestcopy: Provide an helper to safely copy string from guest



>>> On 13.01.15 at 15:25, <julien.grall@xxxxxxxxxx> wrote:
> --- /dev/null
> +++ b/xen/common/guestcopy.c
> @@ -0,0 +1,30 @@
> +#include <xen/config.h>
> +#include <xen/lib.h>
> +#include <xen/guest_access.h>
> +#include <xen/err.h>
> +
> +/* The function copies a string from the guest and adds a NUL to
> + * make sure the string is correctly terminated.
> + */

Coding style.

> +void *safe_copy_string_from_guest(XEN_GUEST_HANDLE(char) u_buf,
> +                                  size_t size, size_t max_size)

Is the "safe_" prefix really meaningful? I.e. is this function more
safe than e.g. copy_from_guest()?

> +{
> +    char *tmp;
> +
> +    if ( size > max_size )
> +        return ERR_PTR(-ENOENT);

-ENOBUFS?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.