While auditing code, I stumbled across a confusing comment which
references a state name that does not exist.  In addition to improving
the comment, I added an assertion, since there is action at a distance
(prepare_for_reply_payload is in states-newstyle.c) for ignoring the
oversized payload.

Signed-off-by: Eric Blake <ebl...@redhat.com>
Reviewed-by: Richard W.M. Jones <rjo...@redhat.com>
Reviewed-by: Laszlo Ersek <ler...@redhat.com>
---
 generator/states-newstyle-opt-go.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/generator/states-newstyle-opt-go.c 
b/generator/states-newstyle-opt-go.c
index 2ef440d4..5bc9a9ae 100644
--- a/generator/states-newstyle-opt-go.c
+++ b/generator/states-newstyle-opt-go.c
@@ -149,8 +149,11 @@  NEWSTYLE.OPT_GO.CHECK_REPLY:

   switch (reply) {
   case NBD_REP_INFO:
-    if (len > maxpayload /* see RECV_NEWSTYLE_OPT_GO_REPLY */)
+    if (len > maxpayload) {
+      /* See prepare_for_reply_payload, used in RECV_REPLY */
+      assert (h->rbuf == NULL);
       debug (h, "skipping large NBD_REP_INFO");
+    }
     else {
       uint16_t info;
       uint64_t exportsize;
-- 
2.41.0

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to