[PATCH 4/5] i386: fix string formatting-related warnings

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

 



fixed the same way as in 70cca82
"kexec: Fix snprintf related compilation warnings"

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
---
 kexec/arch/i386/x86-linux-setup.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 057ee14..76e1185 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -232,8 +232,14 @@ static int parse_edd_extensions(const char *dir, struct edd_info *edd_info)
 	char line[1024];
 	uint16_t flags = 0;
 	FILE *fp;
+	int ret;
+
+	ret = snprintf(filename, PATH_MAX, "%s/%s", dir, "extensions");
+	if (ret < 0 || ret >= PATH_MAX) {
+		fprintf(stderr, "snprintf failed: %s\n", strerror(errno));
+		return -1;
+	}
 
-	snprintf(filename, PATH_MAX, "%s/%s", dir, "extensions");
 	filename[PATH_MAX-1] = 0;
 
 	fp = fopen(filename, "r");
@@ -269,8 +275,14 @@ static int read_edd_raw_data(const char *dir, struct edd_info *edd_info)
 	FILE *fp;
 	size_t read_chars;
 	uint16_t len;
+	int ret;
+
+	ret = snprintf(filename, PATH_MAX, "%s/%s", dir, "raw_data");
+	if (ret < 0 || ret >= PATH_MAX) {
+		fprintf(stderr, "snprintf failed: %s\n", strerror(errno));
+		return -1;
+	}
 
-	snprintf(filename, PATH_MAX, "%s/%s", dir, "raw_data");
 	filename[PATH_MAX-1] = 0;
 
 	fp = fopen(filename, "r");
-- 
2.28.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
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