Re: [PATCH] conf: Use UNIT_MAX for checking max value of unsigned int

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

 



On 11/14/2016 12:13 PM, Nitesh Konkar wrote:
In the current scenario the controller parsing fails
when no index is specified .As the docs point out
that specifying index is optional, libvirt is expected
to fill the index without erroring out.

See: https://bugzilla.redhat.com/show_bug.cgi?id=1344899

Fixing this is not simple. I've tried to make a simple fix, and it's beyond that (see the BZ and all related email threads that it references for details).


Signed-off-by: Nitesh Konkar <nitkon12@xxxxxxxxxxxxxxxxxx>
---
Before the Patch:
cat controller.xml
<controller model="virtio-scsi" type="scsi" />

virsh attach-device vm1 controller.xml  --persistent
error: Failed to attach device from controller.xml
error: internal error: Cannot parse controller index -1

After the patch:
virsh attach-device vm1 controller.xml  --persistent
Device attached successfully

Sure, it doesn't generate an error. But all you've done is make it ignore the fact that the index hasn't been set, you haven't actually set it.

NACK.

---
  src/conf/domain_conf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6e008e2..c52e67f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8374,7 +8374,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
      if (idx) {
          unsigned int idxVal;
          if (virStrToLong_ui(idx, NULL, 10, &idxVal) < 0 ||
-            idxVal > INT_MAX) {
+            idxVal > UINT_MAX) {
              virReportError(VIR_ERR_INTERNAL_ERROR,
                             _("Cannot parse controller index %s"), idx);
              goto error;


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]