From: Md Shofiqul Islam <shofiqtest@gmail.com>
To: u-boot@lists.denx.de
Cc: Tom Rini <trini@konsulko.com>,
Francois Berder <fberder@outlook.fr>,
Md Shofiqul Islam <shofiqtest@gmail.com>
Subject: [PATCH] ge: common: vpd_reader: fix errloc array size in verify_bch()
Date: Sun, 5 Jul 2026 13:08:41 +0300 [thread overview]
Message-ID: <20260705100841.1186360-1-shofiqtest@gmail.com> (raw)
errloc stores bit positions of errors returned by decode_bch().
The maximum number of correctable errors is ecc_bits, so errloc
must have ecc_bits entries. The array was allocated with data_length
entries instead, which is the number of EEPROM data bytes -- orders
of magnitude larger than needed and incorrect.
Fixes: b418dfe16e62 ("board: ge: make VPD code common")
Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com>
---
board/ge/common/vpd_reader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/ge/common/vpd_reader.c b/board/ge/common/vpd_reader.c
index 2422db38013..b3f9e96615d 100644
--- a/board/ge/common/vpd_reader.c
+++ b/board/ge/common/vpd_reader.c
@@ -66,7 +66,7 @@ static int verify_bch(int ecc_bits, unsigned int prim_poly, u8 *data,
return -1;
}
- unsigned int *errloc = (unsigned int *)calloc(data_length,
+ unsigned int *errloc = (unsigned int *)calloc(ecc_bits,
sizeof(unsigned int));
int errors = decode_bch(bch, data, data_length, ecc, NULL, NULL,
errloc);
--
2.51.1
next reply other threads:[~2026-07-05 12:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 10:08 Md Shofiqul Islam [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-07-03 12:35 [PATCH] ge: common: vpd_reader: fix errloc array size in verify_bch() Md Shofiqul Islam
2026-06-30 15:06 Md Shofiqul Islam
2026-06-30 13:39 Md Shofiqul Islam
2026-06-30 14:29 ` Ian Ray
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=20260705100841.1186360-1-shofiqtest@gmail.com \
--to=shofiqtest@gmail.com \
--cc=fberder@outlook.fr \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.