[PATCH v4 2/4] mtd: always initialize 'stats' in struct mtd_oob_ops

Miquel Raynal miquel.raynal at bootlin.com
Wed Sep 21 01:41:11 PDT 2022


On Wed, 2022-06-29 at 12:57:35 UTC, =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= wrote:
> As the 'stats' field in struct mtd_oob_ops is used in conditional
> expressions, ensure it is always zero-initialized in all such structures
> to prevent random stack garbage from being interpreted as a pointer.
> 
> Strictly speaking, this problem currently only needs to be fixed for
> struct mtd_oob_ops structures subsequently passed to mtd_read_oob().
> However, this commit goes a step further and makes all instances of
> struct mtd_oob_ops in the tree zero-initialized, in hope of preventing
> future problems, e.g. if struct mtd_req_stats gets extended with write
> statistics at some point.
> 
> Signed-off-by: Michał Kępień <kernel at kempniu.pl>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel



More information about the linux-mtd mailing list