Skip to content

Commit f559537

Browse files
avasummerUlrich Hecht
authored andcommitted
platform/x86: ibm_rtl: fix EBDA signature search pointer arithmetic
[ Upstream commit 15dd100349b8526cbdf2de0ce3e72e700eb6c208 ] The ibm_rtl_init() function searches for the signature but has a pointer arithmetic error. The loop counter suggests searching at 4-byte intervals but the implementation only advances by 1 byte per iteration. Fix by properly advancing the pointer by sizeof(unsigned int) bytes each iteration. Reported-by: Yuhao Jiang <danisjiang@gmail.com> Reported-by: Junrui Luo <moonafterrain@outlook.com> Fixes: 35f0ce0 ("IBM Real-Time "SMI Free" mode driver -v7") Signed-off-by: Junrui Luo <moonafterrain@outlook.com> Link: https://patch.msgid.link/SYBPR01MB78812D887A92DE3802D0D06EAFA9A@SYBPR01MB7881.ausprd01.prod.outlook.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 45a1bb8 commit f559537

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/platform/x86/ibm_rtl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static int __init ibm_rtl_init(void) {
276276
/* search for the _RTL_ signature at the start of the table */
277277
for (i = 0 ; i < ebda_size/sizeof(unsigned int); i++) {
278278
struct ibm_rtl_table __iomem * tmp;
279-
tmp = (struct ibm_rtl_table __iomem *) (ebda_map+i);
279+
tmp = (struct ibm_rtl_table __iomem *) (ebda_map + i*sizeof(unsigned int));
280280
if ((readq(&tmp->signature) & RTL_MASK) == RTL_SIGNATURE) {
281281
phys_addr_t addr;
282282
unsigned int plen;

0 commit comments

Comments
 (0)