libcareplus/0012-libcare-dump-change-the-return-value.patch
yezengruan eda47481b9 update libcareplus to version 1.0.0-12
kpatch_process: fix possible double free.
ptrace: fix NULL pointer access problem
fix patched process crashing when acccess the global var
fix probably restore cc symbol link fail when kill patch building uncourteous
optimize: Remove unnecessary comparison code

Signed-off-by: yezengruan <yezengruan@huawei.com>
(cherry picked from commit f3d59711105eb667fa2f920958fcbdbb7068afd2)
2022-07-21 15:47:45 +08:00

39 lines
1.1 KiB
Diff

From 037c9ac7e9d3eaa072ae1edaad2bc22e18f4333a Mon Sep 17 00:00:00 2001
From: jiang-dawei15 <jiangdawei15@huawei.com>
Date: Thu, 5 May 2022 10:39:47 +0800
Subject: [PATCH] libcare-dump:change the return value
---
src/libcare-dump.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/libcare-dump.c b/src/libcare-dump.c
index 8736452..b712709 100644
--- a/src/libcare-dump.c
+++ b/src/libcare-dump.c
@@ -45,6 +45,7 @@ void usage()
int kpatch_dump_kpatch_header(const char *input_file)
{
+ int rv;
int fdi = -1;
int ret = -1;
int elf_size;
@@ -67,7 +68,12 @@ int kpatch_dump_kpatch_header(const char *input_file)
goto cleanup;
}
- ret = read(fdi, &kp, sizeof(struct kpatch_file));
+ rv = read(fdi, &kp, sizeof(struct kpatch_file));
+ if (rv <= 0) {
+ printf("Read kpatch file '%s' failed.\n", input_file);
+ goto cleanup;
+ }
+ ret = 0;
printf("%-25s %s\n", "Patch Name:", input_file);
printf("%-25s %s\n", "Magic:", kp.magic);
printf("%-25s %s\n", "Patch id:", kp.id);
--
2.27.0