Skip to content

Commit 54bd55d

Browse files
shiqinggwenlingz
authored andcommitted
hv: fix 'Recursion in procedure calls found'
Here is how the recursion might happen: when there is something wrong | sbuf_put -> memcpy_s -> pr_err -> do_logmsg | | ----------------------------------- Replace 'pr_err' with 'ASSERT' in 'memcpy_s' to break this kind of recursion. Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
1 parent deb4440 commit 54bd55d

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

hypervisor/debug/dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void __assert(uint32_t line, const char *file, const char *txt)
234234
uint64_t rsp = cpu_rsp_get();
235235
uint64_t rbp = cpu_rbp_get();
236236

237-
pr_fatal("Assertion failed in file %s,line %u : %s",
237+
printf("Assertion failed in file %s,line %u : %s",
238238
file, line, txt);
239239
show_host_call_trace(rsp, rbp, pcpu_id);
240240
dump_guest_context(pcpu_id);

hypervisor/include/debug/assert.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ void __assert(uint32_t line, const char *file, const char *txt);
1212

1313
#define ASSERT(x, ...) \
1414
if (!(x)) {\
15-
pr_fatal(__VA_ARGS__);\
1615
__assert(__LINE__, __FILE__, "fatal error");\
1716
}
1817
#else

hypervisor/lib/memory.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,14 +344,12 @@ void *memcpy_s(void *d, size_t dmax, const void *s, size_t slen)
344344
uint8_t *src8;
345345

346346
if (slen == 0U || dmax == 0U || dmax < slen) {
347-
pr_err("%s: invalid src, dest buffer or length.", __func__);
348-
return NULL;
347+
ASSERT(false);
349348
}
350349

351350
if ((d > s && d <= s + slen - 1)
352351
|| (d < s && s <= d + dmax - 1)) {
353-
pr_err("%s: overlap happened.", __func__);
354-
return NULL;
352+
ASSERT(false);
355353
}
356354

357355
/*same memory block, no need to copy*/

0 commit comments

Comments
 (0)