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

Re: [Xen-devel] [PATCH v2 02/21] xen: guestcopy: Provide an helper to safely copy string from guest



>>> On 31.07.14 at 17:00, <julien.grall@xxxxxxxxxx> wrote:
> --- /dev/null
> +++ b/xen/common/guestcopy.c
> @@ -0,0 +1,29 @@
> +#include <xen/config.h>
> +#include <xen/lib.h>
> +#include <xen/guest_access.h>
> +
> +/* The function copies a string from the guest and add a NUL-terminated to
> + * make sure the string is correctly finished. */

"... and adds a NUL-terminator ...". Also not sure about "finished"
here. And please fix the comment style.

> +int safe_copy_string_from_guest(XEN_GUEST_HANDLE(char) u_buf, char **buf,
> +                                unsigned long size, unsigned long max_size)

size_t please.

Further I think this function would benefit from using the definitions
in xen/err.h, eliminating the need to return the buffer pointer via
indirection.

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®.