]> www.infradead.org Git - users/mchehab/rasdaemon.git/commit
mce-amd-k8: be sure to not go past error_msg buffer
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 14 Aug 2018 16:13:54 +0000 (13:13 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 14 Aug 2018 16:13:54 +0000 (13:13 -0300)
commit54a74d94ac0c296c24e66efbee916afab1e3045f
tree0ea5c06adbeb56a1e0a8a62eb0e9c8f7ee61ac35
parent2660e9a4822790d04b1899c0d6ff37d99b36b8c1
mce-amd-k8: be sure to not go past error_msg buffer

As warned by gcc:

mce-amd-k8.c: In function ‘decode_k8_generic_errcode’:
mce-amd-k8.c:136:30: warning: ‘) ’ directive output may be truncated writing 2 bytes into a region of size between 0 and 4095 [-Wformat-truncation=]
   mce_snprintf(e->error_msg, "(%s) ", tmp_buf);
                              ^~~~~~~
ras-mce-handler.h:104:29: note: in definition of macro ‘mce_snprintf’
  snprintf(buf + __n, __len, fmt,  ##arg);  \
                             ^~~
ras-mce-handler.h:104:2: note: ‘snprintf’ output between 4 and 4099 bytes into a destination of size 4096
  snprintf(buf + __n, __len, fmt,  ##arg);  \
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mce-amd-k8.c:136:3: note: in expansion of macro ‘mce_snprintf’
   mce_snprintf(e->error_msg, "(%s) ", tmp_buf);
   ^~~~~~~~~~~~

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
mce-amd-k8.c