Skip to contentSkip to conversation

coverity: Model g_poll()

PATCH Superseded Markus Armbruster 2 participants 3 messages Dec 1, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 coverity: Model g_poll()

Coverity now reports two more CHECKED_RETURN:

* qemu-char.c:1248: Should be fixed by Paolo's "qemu-char: retry g_poll on EINTR".

* migration/qemu-file-unix.c:75: if g_poll() fails, we retry sending before the file descriptor is ready. Errors other than EINTR are mostly theoretical, though.

---
 scripts/coverity-model.c | 9 +++++++++
 1 file changed, 9 insertions(+)
scripts/coverity-model.c +9 -0
index e1d5f45..ee5bf9d 100644
@@ -342,6 +342,15 @@ char *g_strconcat(const char *s, ...)
 
 /* Other glib functions */
 
+typedef struct pollfd GPollFD;
+
+int poll();
+
+int g_poll (GPollFD *fds, unsigned nfds, int timeout)
+{
+    return poll(fds, nfds, timeout);
+}
+
 typedef struct _GIOChannel GIOChannel;
 GIOChannel *g_io_channel_unix_new(int fd)
 {
Signature · 1 line
2.4.3
#1 lore raw
Quoted 8 lines · Markus Armbruster

Coverity now reports two more CHECKED_RETURN:

* qemu-char.c:1248: Should be fixed by Paolo's "qemu-char: retry g_poll on EINTR".

* migration/qemu-file-unix.c:75: if g_poll() fails, we retry sending before the file descriptor is ready. Errors other than EINTR are mostly theoretical, though.

EINTR is harmless too here, you'll just get another EAGAIN. I'll mark it as Intentional / Fix Required in the coverity dashboard.

Paolo

Quoted 2 lines

---

#2 lore raw
Quoted 6 lines · Paolo Bonzini
Quoted 5 lines · Markus Armbruster

Coverity now reports two more CHECKED_RETURN:

* qemu-char.c:1248: Should be fixed by Paolo's "qemu-char: retry g_poll on EINTR".

Quoted 6 lines
Quoted 3 lines

* migration/qemu-file-unix.c:75: if g_poll() fails, we retry sending before the file descriptor is ready. Errors other than EINTR are mostly theoretical, though.

EINTR is harmless too here, you'll just get another EAGAIN. I'll mark it as Intentional / Fix Required in the coverity dashboard.

I posted a cleanup patch anyway. Migration maintainers can decide whether they want it or not.