mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Ard Biesheuvel <mchehab+huawei@kernel.org>,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: [PATCH v3 2/5] efi/cper: Adjust infopfx size to accept an extra space
Date: Wed,  4 Sep 2024 08:07:15 +0200	[thread overview]
Message-ID: <1f92a7f3ceaba7ef877afdb53d3a7bbac58995ce.1725429659.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1725429659.git.mchehab+huawei@kernel.org>

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>
---
 drivers/firmware/efi/cper-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/cper-arm.c b/drivers/firmware/efi/cper-arm.c
index fa9c1c3bf168..eb7ee6af55f2 100644
--- a/drivers/firmware/efi/cper-arm.c
+++ b/drivers/firmware/efi/cper-arm.c
@@ -240,7 +240,7 @@ void cper_print_proc_arm(const char *pfx,
 	int i, len, max_ctx_type;
 	struct cper_arm_err_info *err_info;
 	struct cper_arm_ctx_info *ctx_info;
-	char newpfx[64], infopfx[64];
+	char newpfx[64], infopfx[ARRAY_SIZE(newpfx) + 1];
 
 	printk("%sMIDR: 0x%016llx\n", pfx, proc->midr);
 
-- 
2.46.0


  parent reply	other threads:[~2024-09-04  6:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  6:07 [PATCH v3 0/5] Fix issues with ARM Processor CPER records Mauro Carvalho Chehab
2024-09-04  6:07 ` [PATCH v3 1/5] RAS: Report all ARM processor CPER information to userspace Mauro Carvalho Chehab
2024-09-11 12:47   ` Borislav Petkov
2024-09-04  6:07 ` Mauro Carvalho Chehab [this message]
2024-09-04  6:07 ` [PATCH v3 3/5] efi/cper: Add a new helper function to print bitmasks Mauro Carvalho Chehab
2024-09-04  6:07 ` [PATCH v3 4/5] efi/cper: align ARM CPER type with UEFI 2.9A/2.10 specs Mauro Carvalho Chehab
2024-09-04  6:07 ` [PATCH v3 5/5] docs: efi: add CPER functions to driver-api Mauro Carvalho Chehab
2024-10-11 11:57 ` [PATCH v3 0/5] Fix issues with ARM Processor CPER records Borislav Petkov
2024-10-14 10:00   ` Ard Biesheuvel
2025-06-06 18:30     ` Daniel Ferguson
2025-06-21  8:15       ` Ard Biesheuvel
  -- strict thread matches above, loose matches on Subject: below --
2024-08-05 12:53 Mauro Carvalho Chehab
2024-08-05 12:53 ` [PATCH v3 2/5] efi/cper: Adjust infopfx size to accept an extra space Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f92a7f3ceaba7ef877afdb53d3a7bbac58995ce.1725429659.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bp@alien8.de \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®