[PATCH i-g-t 4/7] Fix truncate string in the snprintf

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

 



This patch fix the following GCC warning:

intel_reg.c: In function ‘dump_decode’:
warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
   snprintf(decode, sizeof(decode), "\n%s", bin);
intel_reg.c:203:3: note: ‘snprintf’ output between 2 and 1025 bytes into a destination of size 1024
[..]

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@xxxxxxxxx>
---
 tools/intel_reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index ddff2794..15ebb86a 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -180,7 +180,7 @@ static void to_binary(char *buf, size_t buflen, uint32_t val)
 
 static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
 {
-	char decode[1024];
+	char decode[2060];
 	char tmp[1024];
 	char bin[1024];
 
-- 
2.18.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux