]> xenbits.xensource.com Git - libvirt.git/commitdiff
vircgroupv1: fix null string specifier argument in virCgroupV1ValidatePlacement
authorScott Davis <scott.davis@starlab.io>
Wed, 25 May 2022 22:20:40 +0000 (18:20 -0400)
committerJán Tomko <jtomko@redhat.com>
Thu, 26 May 2022 08:14:49 +0000 (10:14 +0200)
Detected by gcc 11 -Wformat-overflow:
../../src/util/vircgroupv1.c: In function ‘virCgroupV1ValidatePlacement’:
../../src/util/virerror.h:176:5: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  176 |     virReportErrorHelper(VIR_FROM_THIS, code, __FILE__, \
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  177 |                          __FUNCTION__, __LINE__, __VA_ARGS__)
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/util/vircgroupv1.c:411:13: note: in expansion of macro ‘virReportError’
  411 |             virReportError(VIR_ERR_INTERNAL_ERROR,
      |             ^~~~~~~~~~~~~~
../../src/util/vircgroupv1.c:412:80: note: format string is defined here
  412 |                            _("Could not find placement for v1 controller %s at %s"),
      |                                                                                ^~

Signed-off-by: Scott Davis <scott.davis@starlab.io>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/vircgroupv1.c

index 96f36c3b4d6aa3ee1da80b6c310afeea98f87dd7..cbee08e9315139949618737f19c078ee994b2c28 100644 (file)
@@ -409,9 +409,8 @@ virCgroupV1ValidatePlacement(virCgroup *group,
 
         if (!group->legacy[i].placement) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Could not find placement for v1 controller %s at %s"),
-                           virCgroupV1ControllerTypeToString(i),
-                           group->legacy[i].placement);
+                           _("Could not find placement for v1 controller %s"),
+                           virCgroupV1ControllerTypeToString(i));
             return -1;
         }