[PATCH v2 2/7] remote_proc_version: NULL terminate passed buffer on error.

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

 



From: Don Slutz <dslutz@xxxxxxxxxxx>

Also add cpu argumnet to remote_memory_read.

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
 defs.h   | 2 +-
 memory.c | 4 ++--
 remote.c | 8 ++++++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/defs.h b/defs.h
index a5299cc..86b4fae 100755
--- a/defs.h
+++ b/defs.h
@@ -5535,7 +5535,7 @@ int remote_memory_used(void);
 void remote_exit(void);
 int remote_execute(void);
 void remote_clear_pipeline(void);
-int remote_memory_read(int, char *, int, physaddr_t);
+int remote_memory_read(int, char *, int, physaddr_t, int);
 
 /*
  *  gnu_binutils.c
diff --git a/memory.c b/memory.c
index d936b53..5ec454d 100755
--- a/memory.c
+++ b/memory.c
@@ -2492,7 +2492,7 @@ write_lkcd_dumpfile(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr)
 int
 read_daemon(int fd, void *bufptr, int cnt, ulong vaddr, physaddr_t paddr) 
 {
-	if (remote_memory_read(pc->rmfd, bufptr, cnt, paddr) == cnt)
+	if (remote_memory_read(pc->rmfd, bufptr, cnt, paddr, -1) == cnt)
 		return cnt;
 
 	if (!IS_VMALLOC_ADDR(vaddr) || DUMPFILE())
@@ -2506,7 +2506,7 @@ read_daemon(int fd, void *bufptr, int cnt, ulong vaddr, physaddr_t paddr)
          *  the only alternative is to read it from /dev/kmem.
          */
 
-	if (BITS32() && remote_memory_read(pc->rkfd, bufptr, cnt, vaddr) == cnt)
+	if (BITS32() && remote_memory_read(pc->rkfd, bufptr, cnt, vaddr, -1) == cnt)
                 return cnt;
 
 	return READ_ERROR;
diff --git a/remote.c b/remote.c
index 95ce03d..204f7b8 100755
--- a/remote.c
+++ b/remote.c
@@ -2281,8 +2281,10 @@ remote_proc_version(char *buf)
         sprintf(sendbuf, "PROC_VERSION");
         remote_tcp_write_string(pc->sockfd, sendbuf);
         remote_tcp_read_string(pc->sockfd, recvbuf, BUFSIZE-1, NIL_MODE());
-        if (STREQ(recvbuf, "<FAIL>"))
+        if (STREQ(recvbuf, "<FAIL>")) {
+		buf[0] = 0;
                 return FALSE;
+	}
         strcpy(buf, recvbuf);
 	return TRUE;
 }
@@ -3470,7 +3472,7 @@ remote_memory_dump(int verbose)
  *  a page in length.
  */
 int 
-remote_memory_read(int rfd, char *buffer, int cnt, physaddr_t address)
+remote_memory_read(int rfd, char *buffer, int cnt, physaddr_t address, int vcpu)
 {
         char sendbuf[BUFSIZE];
 	char datahdr[DATA_HDRSIZE];
@@ -3489,6 +3491,8 @@ remote_memory_read(int rfd, char *buffer, int cnt, physaddr_t address)
                 sprintf(sendbuf, "READ_LKCD %d %lx %d", rfd, addr, cnt);
         else if (pc->flags & REM_S390D)
                 sprintf(sendbuf, "READ_S390D %d %lx %d", rfd, addr, cnt);
+        else if (vcpu >= 0)
+                sprintf(sendbuf, "READ_LIVE %d %lx %d %d", rfd, addr, cnt, vcpu);
         else
                 sprintf(sendbuf, "READ_LIVE %d %lx %d", rfd, addr, cnt);
 
-- 
1.8.4

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux