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

Re: [PATCH 2/3] xen: Rename asprintf() to xasprintf()


  • To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Mon, 21 Feb 2022 14:20:21 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i1QC6A25OxxBe9hEOgbrdZsifJgbnoH/2o0b3shjwtA=; b=ZdeAZlCa9VcrSnBgMcpV7zElQVPTfXu5M0tfx7JU+7fslWmd8SqnS4bul97ToNEOu/eB5gxZJIwiHBIeRIzJfoPz9ckbd9VrXG4BDXE7sBjlYtcTwY79uogw9MX+jMkqiQWAqXJaiZOx2Q28BTNXjVXY9g2u3onMVAugAnY7/V3ql4IKnYmf2tAx4xXAYaj776G4a2Gw1UDoE7cncJqkFW3n0hDV48FRGGdoWR2YbE2Z/u9Pw1LISqMzKHleqQyFh222GC/mtag6G3+tyNhcVdRWJr2QLO09Fq3bSZU+u/9B9RmL9EeHIPE3SU2Q7y57b/06rSHwSl6xrUqnaDf26A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I5bHhga9rzY/beaHejJa3cg9AwmXMKw7GjXUVBBet5Hu44xUoz/sP2T8q5GtnEQU2ART5oeV/U/COoBHfYSpZpSPCK9L9fqnE0beVm0kKn9wB6ZjtNt25Q+uyEP/LIlCMlbKX+AasZED/THhMa8KEfzooig+KIWSavgzt74Sfn7/tDEkqsiLLq2r32SNDwJTWmOaysn0wD+32AwTaW1c1MEUAVF6u9yRexLpItUrIae86iRX3DSwTS4Ktcv9mUEY391Xlsc40/x/HlQ8qOOWPh3NtYVcX2Is92uc7kUp51dp4Gu5xZUscbPg70bPyDbU+dOBmxyoo9HsxHeoF9p+Hg==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Mon, 21 Feb 2022 14:20:36 +0000
  • Ironport-data: A9a23:C2lKo6DDDn1LChVW//njw5YqxClBgxIJ4kV8jS/XYbTApGsghWQAx zcdWjuFOvnfZmOgeI0naY209EkDsJaAn9dmQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMZiaA4E/raNANlFEkvU2ybuOU5NXsZ2YhFWeIdA970Ug5w7Rj29Yx6TSEK1jlV e3a8pW31GCNg1aYAkpMg05UgEoy1BhakGpwUm0WPZinjneH/5UmJMt3yZWKB2n5WuFp8tuSH I4v+l0bElTxpH/BAvv9+lryn9ZjrrT6ZWBigVIOM0Sub4QrSoXfHc/XOdJFAXq7hQllkPgq0 8hq69u+YzwqEYeTodw4WQZ7PHpXaPguFL/veRBTsOSWxkzCNXDt3+9vHAc9OohwFuRfWD8Us 6ZCcXZUM07F17neLLGTE4GAguwKKsXxMZxZkXZn1TzDVt4tQIzZQrWM7thdtNs1rp4SQ6uEP 5NCAdZpRDb+Zgd/OFYvM54nl76GmCnkfxEAjmvA8MLb5ECMlVcsgdABKuH9ZdiiVchT2EGCq Qru/Xn9AxwcHMySz3yC6H3ErvfGgCfTSI8UUrqi+ZZCm0aPz2YeDBkXU1qTovSjjEO6HdVFJ CQ86ico6KQ/6kGvZt38RAGj5m6JuAYGXNhdGPF87xuCooLV/ASxFmUCViRGatEtqIkxXzNC/ n2jks7tBDdvmKaIUn/b/bCRxQ5eIgBMczVEP3VdC1JYvZ+z++nfky4jUP44C7OS0Jr7Mwrz7 BrVlRAbjaowopUigvDTEU/8vxqgoZ3ATwgQ7wrRX3644g4RWLNJd7BE+nCAs68ecd/xok2p+ SFdxpPAtLxm4YSlyXTVKNjhCo1F8Bps3Nf0pVd0V6cs+D22k5JIVdABuWouTKuF3yttRNMIX KMxkV4LjHOwFCHzBUOSX25WI553pZUM7fy/CpjpgiNmO/CdjjOv8iB0flK31GvwikUqmqxXE c7FLZv3XSpLVPU6lmveqwIhPVgDnH1W+I8ubcqjk0TPPUS2PxZ5tovpwHPRN7tkvctoUS3e8 spFNtvi9vmseLaWX8UjyqZKdQpiBSFiXfje8pULHsbeclsOMDxwUJf5nOJ+E7GJaowIz48kC FnmARQGoLc+7FWaQTi3hodLMu23Bs8n9SphVcHuVH7xs0UejU+UxP53X7M8fKU99fwlyvhxT vIffN6HDOgJQTPCkwnxp7GmxGC+XHxHXT6zAhc=
  • Ironport-hdrordr: A9a23:CnN2+K09zul8CFstclIcjQqjBEgkLtp133Aq2lEZdPU0SKGlfg 6V/MjztCWE7Ar5PUtLpTnuAsa9qB/nm6KdgrNhWItKPjOW21dARbsKheffKlXbcBEWndQtt5 uIHZIeNDXxZ2IK8PoT4mODYqodKA/sytHWuQ/cpU0dMz2Dc8tbnmBE4p7wKDwMeOFBb6BJcq a01458iBeLX28YVci/DmltZZm4mzWa/KiWGCLvHnQcmXGzsQ8=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYJwpOs0szyq0MVUKA4rk1u5+GKayd3CkAgAACGQCAAA9EAIAAILUA
  • Thread-topic: [PATCH 2/3] xen: Rename asprintf() to xasprintf()

On 21/02/2022 12:23, Roger Pau Monne wrote:
> On Mon, Feb 21, 2022 at 11:28:39AM +0000, Andrew Cooper wrote:
>> On 21/02/2022 11:21, Roger Pau Monné wrote:
>>> On Mon, Feb 21, 2022 at 10:02:53AM +0000, Andrew Cooper wrote:
>>>> Coverity reports that there is a memory leak in
>>>> ioreq_server_alloc_rangesets().  This would be true if Xen's 
>>>> implementation of
>>>> asprintf() had glibc's return semantics, but it doesn't.
>>>>
>>>> Rename to xasprintf() to reduce confusion for Coverity and other 
>>>> developers.
>>> It would seem more natural to me to rename to asprintk.
>> Why?  This infrastructure doesn't emit the string to any console.
> Right, but the f in printf is for print formatted, not for where the
> output is supposed to go. So printk is the outlier and should instead
> be kprintf?
>
> I can buy into using xasprintf (also because that's what Linux does
> with kasprintf), but I don't think it's so obvious given the precedent
> of having printk instead of printf.

The naming isn't ideal, but this is Xen's local version of the thing
called asprintf() in userspace.

Naming it anything other than xasprintf() is going to be even more
confusing for people than this mess already is...

>>>  I assume
>>> there's no way for Coverity to prevent overrides with builtin models?
>>>
>>> I've been searching, but there doesn't seem to be any option to
>>> prevent overrides by builtin models?
>> No, and we absolutely wouldn't want to skip the model even if we could,
>> because that would break asprintf() analysis for userspace.
> Well, we could maybe find a way to only enable the flag for hypervisor
> code build, but anyway, it's pointless to discus if there's no flag in
> the first place.
>
> Coverity could be clever enough to check if there's an implementation
> provided for those, instead of unconditionally override with a
> model.

There is no way to disable the model for asprintf().

~Andrew

 


Rackspace

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