Skip to contentSkip to conversation

bugs from gcc warning fixes v3

PATCH Applied [email protected] 2 participants 8 messages Aug 31, 2010 – Sep 4, 2010

lore
Share & tools
lore
#0 lore raw

cover bugs from gcc warning fixes v3

From: Jes Sorensen <[email protected]>

Hi,

Given the contention of the previous patch set, this is a stripped down version that doesn't have any of the parts included that got people up in arms. Lets at least start out getting the real bugs fixed and we can look at the other issues in parallel.

Cheers,
Jes

Jes Sorensen (6):
Remove unused argument for nbd_client()
Respect return value from nbd_client()
Fix repeated typo: was "end if list" instead of "end of list" size_t is unsigned, change to ssize_t to handle errors from
tight_compress_data()
Change DPRINTF() to do{}while(0) to avoid compiler warning load_multiboot(): get_image_size() returns int

 hw/multiboot.c     |    2 +-
 nbd.c              |    4 ++--
 nbd.h              |    2 +-
 qemu-config.c      |   12 ++++++------
 qemu-nbd.c         |    5 ++++-
 slirp/bootp.c      |    2 +-
 ui/vnc-enc-tight.c |    8 ++++----
 7 files changed, 19 insertions(+), 16 deletions(-)
Signature · 1 line
1.7.2.2
#1 lore raw

PATCH 1/6 Remove unused argument for nbd_client()

From: Jes Sorensen <[email protected]>

---
 nbd.c      |    4 ++--
 nbd.h      |    2 +-
 qemu-nbd.c |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
nbd.c +2 -2
index a9f295f..7049998 100644
@@ -393,7 +393,7 @@ int nbd_disconnect(int fd)
 	return 0;
 }
 
-int nbd_client(int fd, int csock)
+int nbd_client(int fd)
 {
 	int ret;
 	int serrno;
@@ -427,7 +427,7 @@ int nbd_disconnect(int fd)
     return -1;
 }
 
-int nbd_client(int fd, int csock)
+int nbd_client(int fd)
 {
     errno = ENOTSUP;
     return -1;
nbd.h +1 -1
index 5a1fbdf..f103c3c 100644
@@ -55,7 +55,7 @@ int nbd_send_request(int csock, struct nbd_request *request);
 int nbd_receive_reply(int csock, struct nbd_reply *reply);
 int nbd_trip(BlockDriverState *bs, int csock, off_t size, uint64_t dev_offset,
              off_t *offset, bool readonly, uint8_t *data, int data_size);
-int nbd_client(int fd, int csock);
+int nbd_client(int fd);
 int nbd_disconnect(int fd);
 
 #endif
qemu-nbd.c +1 -1
index 4e607cf..9cc8f47 100644
@@ -417,7 +417,7 @@ int main(int argc, char **argv)
 
             show_parts(device);
 
-            nbd_client(fd, sock);
+            nbd_client(fd);
             close(fd);
  out:
             kill(pid, SIGTERM);
Signature · 1 line
1.7.2.2
#2 lore raw

PATCH 2/6 Respect return value from nbd_client()

In reply to [email protected]

From: Jes Sorensen <[email protected]>

---
 qemu-nbd.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
qemu-nbd.c +4 -1
index 9cc8f47..67ce50b 100644
@@ -417,7 +417,10 @@ int main(int argc, char **argv)
 
             show_parts(device);
 
-            nbd_client(fd);
+            ret = nbd_client(fd);
+            if (ret) {
+                ret = 1;
+            }
             close(fd);
  out:
             kill(pid, SIGTERM);
Signature · 1 line
1.7.2.2
#3 lore raw

PATCH 3/6 Fix repeated typo: was "end if list" instead of "end of list"

In reply to [email protected]

From: Jes Sorensen <[email protected]>

---
 qemu-config.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
qemu-config.c +6 -6
index 3abe655..1efdbec 100644
@@ -80,7 +80,7 @@ static QemuOptsList qemu_drive_opts = {
             .name = "readonly",
             .type = QEMU_OPT_BOOL,
         },
-        { /* end if list */ }
+        { /* end of list */ }
     },
 };
 
@@ -147,7 +147,7 @@ static QemuOptsList qemu_chardev_opts = {
             .name = "signal",
             .type = QEMU_OPT_BOOL,
         },
-        { /* end if list */ }
+        { /* end of list */ }
     },
 };
 
@@ -203,7 +203,7 @@ static QemuOptsList qemu_device_opts = {
          * sanity checking will happen later
          * when setting device properties
          */
-        { /* end if list */ }
+        { /* end of list */ }
     },
 };
 
@@ -247,7 +247,7 @@ static QemuOptsList qemu_rtc_opts = {
             .name = "driftfix",
             .type = QEMU_OPT_STRING,
         },
-        { /* end if list */ }
+        { /* end of list */ }
     },
 };
 
@@ -265,7 +265,7 @@ static QemuOptsList qemu_global_opts = {
             .name = "value",
             .type = QEMU_OPT_STRING,
         },
-        { /* end if list */ }
+        { /* end of list */ }
     },
 };
 
@@ -284,7 +284,7 @@ static QemuOptsList qemu_mon_opts = {
             .name = "default",
             .type = QEMU_OPT_BOOL,
         },
-        { /* end if list */ }
+        { /* end of list */ }
     },
 };
 
Signature · 1 line
1.7.2.2
#4 lore raw

PATCH 4/6 size_t is unsigned, change to ssize_t to handle errors from tight_compress_data()

In reply to [email protected]

From: Jes Sorensen <[email protected]>

---
 ui/vnc-enc-tight.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
ui/vnc-enc-tight.c +4 -4
index c4c9c3b..c942bb7 100644
@@ -905,7 +905,7 @@ static void tight_pack24(VncState *vs, uint8_t *buf, size_t count, size_t *ret)
 static int send_full_color_rect(VncState *vs, int x, int y, int w, int h)
 {
     int stream = 0;
-    size_t bytes;
+    ssize_t bytes;
 
 #ifdef CONFIG_VNC_PNG
     if (tight_can_send_png_rect(vs, w, h)) {
@@ -949,7 +949,7 @@ static int send_solid_rect(VncState *vs)
 static int send_mono_rect(VncState *vs, int x, int y,
                           int w, int h, uint32_t bg, uint32_t fg)
 {
-    size_t bytes;
+    ssize_t bytes;
     int stream = 1;
     int level = tight_conf[vs->tight.compression].mono_zlib_level;
 
@@ -1029,7 +1029,7 @@ static bool send_gradient_rect(VncState *vs, int x, int y, int w, int h)
 {
     int stream = 3;
     int level = tight_conf[vs->tight.compression].gradient_zlib_level;
-    size_t bytes;
+    ssize_t bytes;
 
     if (vs->clientds.pf.bytes_per_pixel == 1)
         return send_full_color_rect(vs, x, y, w, h);
@@ -1066,7 +1066,7 @@ static int send_palette_rect(VncState *vs, int x, int y,
     int stream = 2;
     int level = tight_conf[vs->tight.compression].idx_zlib_level;
     int colors;
-    size_t bytes;
+    ssize_t bytes;
 
 #ifdef CONFIG_VNC_PNG
     if (tight_can_send_png_rect(vs, w, h)) {
Signature · 1 line
1.7.2.2
#5 lore raw

PATCH 5/6 Change DPRINTF() to do{}while(0) to avoid compiler warning

In reply to [email protected]

From: Jes Sorensen <[email protected]>

---
 slirp/bootp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
slirp/bootp.c +1 -1
index 3e4e881..41460ff 100644
@@ -33,7 +33,7 @@ static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE };
 #define DPRINTF(fmt, ...) \
 do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ##  __VA_ARGS__); fflush(dfd); } while (0)
 #else
-#define DPRINTF(fmt, ...)
+#define DPRINTF(fmt, ...) do{}while(0)
 #endif
 
 static BOOTPClient *get_new_addr(Slirp *slirp, struct in_addr *paddr,
Signature · 1 line
1.7.2.2
#6 lore raw

PATCH 6/6 load_multiboot(): get_image_size() returns int

In reply to [email protected]

From: Jes Sorensen <[email protected]>

Do not store return of get_image_size() in a uint32_t as it makes it impossible to detect error returns from get_image_size.

---
 hw/multiboot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/multiboot.c +1 -1
index dc980e6..f9097a2 100644
@@ -252,7 +252,7 @@ int load_multiboot(void *fw_cfg,
 
         do {
             char *next_space;
-            uint32_t mb_mod_length;
+            int mb_mod_length;
             uint32_t offs = mbs.mb_buf_size;
 
             next_initrd = strchr(initrd_filename, ',');
Signature · 1 line
1.7.2.2
Applied
#7 lore raw
In reply to [email protected]

Thanks, applied all.

Quoted 35 lines · On Tue, Aug 31, 2010 at 7:30 AM, <[email protected]> wrote:

From: Jes Sorensen <[email protected]>

Hi,

Given the contention of the previous patch set, this is a stripped down version that doesn't have any of the parts included that got people up in arms. Lets at least start out getting the real bugs fixed and we can look at the other issues in parallel.

Cheers,
Jes

Jes Sorensen (6):
 Remove unused argument for nbd_client()
 Respect return value from nbd_client()
 Fix repeated typo: was "end if list" instead of "end of list" size_t is unsigned, change to ssize_t to handle errors from tight_compress_data()
 Change DPRINTF() to do{}while(0) to avoid compiler warning load_multiboot(): get_image_size() returns int

 hw/multiboot.c     |    2 +-
 nbd.c              |    4 ++--
 nbd.h              |    2 +-
 qemu-config.c      |   12 ++++++------
 qemu-nbd.c         |    5 ++++-
 slirp/bootp.c      |    2 +-
 ui/vnc-enc-tight.c |    8 ++++----

 7 files changed, 19 insertions(+), 16 deletions(-)

--
1.7.2.2