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>
static void decode_k8_generic_errcode(struct mce_event *e)
{
- char tmp_buf[4096];
+ char tmp_buf[4092];
unsigned short errcode = e->status & 0xffff;
int n;