[PATCH 2/2] sadump_info: Return empty string instead of NULL
Stefan Wiehler
stefan.wiehler at nokia.com
Thu Aug 15 07:17:34 PDT 2024
Found via -Werror:
In file included from makedumpfile.h:47,
from makedumpfile.c:16:
makedumpfile.c: In function ‘initial’:
makedumpfile.c:4546:29: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
4546 | MSG("because %s is sadump %s format.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
print_info.h:61:41: note: in definition of macro ‘MSG’
61 | fprintf(stdout, x); \
| ^
makedumpfile.c:4546:51: note: format string is defined here
4546 | MSG("because %s is sadump %s format.\n",
| ^~
makedumpfile.c:4546:29: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
4546 | MSG("because %s is sadump %s format.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
print_info.h:59:41: note: in definition of macro ‘MSG’
59 | fprintf(stderr, x); \
| ^
makedumpfile.c:4546:51: note: format string is defined here
4546 | MSG("because %s is sadump %s format.\n",
|
Signed-off-by: Stefan Wiehler <stefan.wiehler at nokia.com>
---
sadump_info.c | 2 +-
sadump_info.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sadump_info.c b/sadump_info.c
index 2c44068..0dbde90 100644
--- a/sadump_info.c
+++ b/sadump_info.c
@@ -2351,7 +2351,7 @@ sadump_format_type_name(void)
case SADUMP_UNKNOWN:
return "unknown";
}
- return NULL;
+ return "";
}
void
diff --git a/sadump_info.h b/sadump_info.h
index 131687a..f7872b4 100644
--- a/sadump_info.h
+++ b/sadump_info.h
@@ -142,7 +142,7 @@ sadump_head_disk_name_memory(void)
static inline char *sadump_format_type_name(void)
{
- return NULL;
+ return "";
}
static inline void free_sadump_info(void)
--
2.42.0
More information about the kexec
mailing list