mtd: physmap: physmap-bt1-rom: Fix unintentional stack access
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 12 Feb 2021 10:40:22 +0000 (04:40 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 May 2021 12:47:13 +0000 (14:47 +0200)
commit34ec706bf0b7c4ca249a729c1bcb91f706c7a7be
tree508c361ba78d3f84753172a317c00b42d0a34e6b
parent706e60c1923718d145ca5550aecc3228c54dd3b0
mtd: physmap: physmap-bt1-rom: Fix unintentional stack access

commit 683313993dbe1651c7aa00bb42a041d70e914925 upstream.

Cast &data to (char *) in order to avoid unintentionally accessing
the stack.

Notice that data is of type u32, so any increment to &data
will be in the order of 4-byte chunks, and this piece of code
is actually intended to be a byte offset.

Fixes: b3e79e7682e0 ("mtd: physmap: Add Baikal-T1 physically mapped ROM support")
Addresses-Coverity-ID: 1497765 ("Out-of-bounds access")
Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210212104022.GA242669@embeddedor
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/maps/physmap-bt1-rom.c