From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v3 04/24] xen: guestcopy: Provide an helper to safely copy string from guest Date: Tue, 20 Jan 2015 13:16:14 +0000 Message-ID: <54BE632E02000078000570D7@mail.emea.novell.com> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> <1421159133-31526-5-git-send-email-julien.grall@linaro.org> <54BD44280200007800056A49@mail.emea.novell.com> <54BE4DD4.8050602@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YDYfL-0004hg-8c for xen-devel@lists.xenproject.org; Tue, 20 Jan 2015 13:16:19 +0000 In-Reply-To: <54BE4DD4.8050602@linaro.org> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Keir Fraser , ian.campbell@citrix.com, tim@xen.org, Ian Jackson , stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org, Daniel De Graaf List-Id: xen-devel@lists.xenproject.org >>> On 20.01.15 at 13:45, wrote: > On 19/01/15 16:51, Jan Beulich wrote: >>>>> On 13.01.15 at 15:25, wrote: >>> +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()? > > It's safe in the sense, the function adds a NUL to make sure the strings > is correctly terminated. > > On the first v1, you said that name "copy_string_from_guest" doesn't > match the behavior of the generic helper [1]. So which name do you > suggest for this function? Ah, so the safe_ here follows safe_str{cat,cpy}() - that's fine then I guess. Jan