Skip to content

Commit 8ad2c72

Browse files
mchehabardbiesheuvel
authored andcommitted
efi/cper: Adjust infopfx size to accept an extra space
Compiling with W=1 with werror enabled produces an error: drivers/firmware/efi/cper-arm.c: In function ‘cper_print_proc_arm’: drivers/firmware/efi/cper-arm.c:298:64: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=] 298 | snprintf(infopfx, sizeof(infopfx), "%s ", newpfx); | ^ drivers/firmware/efi/cper-arm.c:298:25: note: ‘snprintf’ output between 2 and 65 bytes into a destination of size 64 298 | snprintf(infopfx, sizeof(infopfx), "%s ", newpfx); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ As the logic there adds an space at the end of infopx buffer. Add an extra space to avoid such warning. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 0595451 commit 8ad2c72

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/firmware/efi/cper-arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void cper_print_proc_arm(const char *pfx,
240240
int i, len, max_ctx_type;
241241
struct cper_arm_err_info *err_info;
242242
struct cper_arm_ctx_info *ctx_info;
243-
char newpfx[64], infopfx[64];
243+
char newpfx[64], infopfx[ARRAY_SIZE(newpfx) + 1];
244244

245245
printk("%sMIDR: 0x%016llx\n", pfx, proc->midr);
246246

0 commit comments

Comments
 (0)