[PATCH] node_device_udev: add error reporting to udevProcessCCWGroup

Boris Fiuczynski posted 1 patch 10 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20250206162752.116297-1-fiuczy@linux.ibm.com
src/node_device/node_device_udev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH] node_device_udev: add error reporting to udevProcessCCWGroup
Posted by Boris Fiuczynski 10 months, 2 weeks ago
Add reporting an internal error when the string to type conversion of
devtype fails as this indicates a serious problem since devtype was used
to get into this method during the udev event handling.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
---
 src/node_device/node_device_udev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 7b4ff80f8f..344b39e97a 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1415,8 +1415,12 @@ udevProcessCCWGroup(struct udev_device *device,
 
     udevGenerateDeviceName(device, def, NULL);
 
-    if ((tmp = virNodeDevCCWGroupCapTypeFromString(devtype)) < 0)
+    if ((tmp = virNodeDevCCWGroupCapTypeFromString(devtype)) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("failed to find a supported CCW group capability type '%1$s'"),
+                       devtype);
         return -1;
+    }
 
     data->ccwgroup_dev.type = tmp;
 
-- 
2.47.0
Re: [PATCH] node_device_udev: add error reporting to udevProcessCCWGroup
Posted by Michal Prívozník 10 months, 2 weeks ago
On 2/6/25 17:27, Boris Fiuczynski wrote:
> Add reporting an internal error when the string to type conversion of
> devtype fails as this indicates a serious problem since devtype was used
> to get into this method during the udev event handling.
> 
> Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
> ---
>  src/node_device/node_device_udev.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal