[PATCH 2/2] sadump_info: Return empty string instead of NULL

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

 



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@xxxxxxxxx>
---
 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


_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux