irqbalance: upstream patch to fix segfault
[feed/packages.git] / utils / irqbalance / patches / 0002-post-190-fix-check-saveptr-NULL.patch
1 From 522883505d3b02e3294f045f49007b61c00e2c31 Mon Sep 17 00:00:00 2001
2 From: Chao Liu <liuchao173@huawei.com>
3 Date: Wed, 8 Jun 2022 10:04:02 +0800
4 Subject: [PATCH] check whether savedptr is NULL before invoking strlen
5
6 savedptr can be null in musl libc, so the strlen(NULL) will segfault
7
8 Signed-off-by: Chao Liu <liuchao173@huawei.com>
9 ---
10 procinterrupts.c | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13 --- a/procinterrupts.c
14 +++ b/procinterrupts.c
15 @@ -178,7 +178,7 @@ void init_irq_class_and_type(char *saved
16 }
17
18 #ifdef AARCH64
19 - if (strlen(savedptr) > 0) {
20 + if (savedptr && strlen(savedptr) > 0) {
21 snprintf(irq_fullname, PATH_MAX, "%s %s", last_token, savedptr);
22 tmp = strchr(irq_fullname, '\n');
23 if (tmp)