[libvirt PATCH] nodedev: Fix possible NULL pointer dereference on vfiogroup opening
Ján Tomko
jtomko at redhat.com
Fri Apr 16 12:13:33 UTC 2021
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 at redhat.com>
>---
> 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 at redhat.com>
CommitDate: 2021-04-15 08:51:37 -0500
nodedev: handle null return from GetIOMMUGroupDev()
from a different series.
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210416/41fedfd4/attachment-0001.sig>
More information about the libvir-list
mailing list