Re: [libvirt PATCH] nodedev: Fix possible NULL pointer dereference on vfiogroup opening

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

 



On a Tuesday in 2021, Erik Skultety wrote:
Coverity report:
   1193    g_autofree char *vfiogroup =
   1194        virMediatedDeviceGetIOMMUGroupDev(def->caps->data.mdev.uuid);

   >>> CID 317619:  Null pointer dereferences  (NULL_RETURNS)
   >>> Dereferencing a pointer that might be "NULL" "vfiogroup" when
       calling "open". [Note: The source code implementation of the
       function has been overridden by a builtin model.]

   1195    VIR_AUTOCLOSE fd = open(vfiogroup, O_RDONLY);

This patch shuffles the declarations in the affected 'if' block a bit
to make it more readable after adding the NULL pointer condition.

Note that error is not reported in this patch, because if @vfiogroup
is NULL, then it must have been a system error which was already
reported by the called function. Don't get confused by
virMediatedDeviceGetIOMMUGroupDev returning NULL on an empty UUID,
mdevs will always have one.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
src/node_device/node_device_driver.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)


Just for the record, almost identical patch was merged as:

commit 5c4b2bf7709ef517502fccdf3d92b166f8f82ba4
Author:     Jonathon Jongsma <jjongsma@xxxxxxxxxx>
CommitDate: 2021-04-15 08:51:37 -0500

    nodedev: handle null return from GetIOMMUGroupDev()

from a different series.

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux