From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>, James Morse <james.morse@arm.com>,
Shiju Jose <shiju.jose@huawei.com>,
Tony Luck <tony.luck@intel.com>, Ard Biesheuvel <ardb@kernel.org>,
<linux-edac@vger.kernel.org>, <linux-efi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/3] efi/cper: Adjust infopfx size to accept an extra space
Date: Fri, 21 Jun 2024 10:04:23 +0100 [thread overview]
Message-ID: <20240621100423.0000624c@Huawei.com> (raw)
In-Reply-To: <a8cfcd9e9827770de748db7be44362a98c957642.1718906288.git.mchehab+huawei@kernel.org>
On Thu, 20 Jun 2024 20:01:44 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:
> 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>
Trivial suggestion inline. Either way LGTM
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..d9bbcea0adf4 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[65];
Maybe make it explicit so we don't wonder if it was
a typo in future. Something like?
char newpfx[64];
char infofx[ARRAY_SIZE(newpfx) + 1];
>
> printk("%sMIDR: 0x%016llx\n", pfx, proc->midr);
>
next prev parent reply other threads:[~2024-06-21 9:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 18:01 [PATCH v4 0/3] Fix CPER issues related to UEFI 2.9A Errata Mauro Carvalho Chehab
2024-06-20 18:01 ` [PATCH v4 1/3] efi/cper: Adjust infopfx size to accept an extra space Mauro Carvalho Chehab
2024-06-21 9:04 ` Jonathan Cameron [this message]
2024-06-20 18:01 ` [PATCH v4 2/3] efi/cper: Add a new helper function to print bitmasks Mauro Carvalho Chehab
2024-06-20 18:08 ` Luck, Tony
2024-06-21 9:20 ` Jonathan Cameron
2024-06-21 9:26 ` Jonathan Cameron
2024-06-21 9:39 ` Mauro Carvalho Chehab
2024-06-20 18:01 ` [PATCH v4 3/3] efi/cper: align ARM CPER type with UEFI 2.9A/2.10 specs Mauro Carvalho Chehab
2024-06-21 9:30 ` Jonathan Cameron
2024-06-21 9:47 ` Mauro Carvalho Chehab
2024-06-21 7:45 ` [PATCH v4 0/3] Fix CPER issues related to UEFI 2.9A Errata Ard Biesheuvel
2024-06-21 15:26 ` 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=20240621100423.0000624c@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=ardb@kernel.org \
--cc=bp@alien8.de \
--cc=james.morse@arm.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=shiju.jose@huawei.com \
--cc=tony.luck@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).