[libvirt] [PATCH] hostdev: Fix build with GCC's static analysis in mdev

Martin Kletzander mkletzan at redhat.com
Tue Mar 28 07:56:41 UTC 2017


On Mon, Mar 27, 2017 at 08:24:58PM +0200, Martin Kletzander wrote:
>On Mon, Mar 27, 2017 at 12:30:23PM -0400, Laine Stump wrote:
>>On 03/27/2017 11:40 AM, John Ferlan wrote:
>>>
>>>
>>> On 03/27/2017 11:30 AM, Martin Kletzander wrote:
>>>> Similarly to eec3b255d26e7b38bdb0830990569fd91aee661f, fix build with
>>>> lv_cv_static_analysis=yes.
>>>>
>>>> Caused by a4a39d90ab4930750bcbcfccffdf6bb6d310b5d5
>>>> ---
>>>>  src/util/virhostdev.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>
>>> Sure that's another way to fix it... Could have also gone with the
>>> removal of NONNULL in the prototype like I did.  IDC whichever way is
>>> deemed "more appropriate"...
>>>
>>> Seeing as drv_name is only ever passed as QEMU_DRIVER_NAME, but dom_name
>>> is passed from 'name' which doesn't have the NONNULL on it, that's why I
>>> chose removing NONNULL from the prototype.
>>
>>I think I prefer John's way too. (At least partly because I dislike
>>ATTRIBUTE_NONNULL() and would like to see as many of them as possible go
>>away).
>>
>
>Actually, I do too.  I would love to remove all of them.  But for that
>we'd have to reach a decision.  However there are not only cons, some
>pros can be that the compiler is able to make better guesses or not have
>to be guessing at all.  As a counter-argument, there are way more
>attribute we could use and we don't, plus libvirt is not the CPU hogger
>where we would have to go optimize so low.  So while the answer is not
>clear, I wouldn't, as mentioned before, be against removing all such
>occurrences, maybe except public APIs, if someone happens to have a good
>reason for that.

I see your commit from 2012 now.  And I think we might consider removing
attribute_nonnull altogether.  Let me propose a patch...

>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170328/e2f10114/attachment-0001.sig>


More information about the libvir-list mailing list