From: Jay Freyensee Date: Thu, 21 Jul 2016 03:26:16 +0000 (-0600) Subject: nvme: initialize variable before logical OR'ing it X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa9a89fc6637958594f285c8466422105e86e28c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git nvme: initialize variable before logical OR'ing it It is typically not good coding or secure coding practice to logical OR a variable without an initialization value first. Here on this line: integrity.flags |= BLK_INTEGRITY_DEVICE_CAPABLE; BLK_INTEGRITY_DEVICE_CAPABLE is being OR'ed to a member variable never set to an initial value. This patch fixes that. Signed-off-by: Jay Freyensee Reviewed-by: Ming Lin Reviewed-by: Sagi Grimberg Reviewed-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 9f0ec3b4659f..74b1d380dd42 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -842,6 +842,7 @@ static void nvme_init_integrity(struct nvme_ns *ns) { struct blk_integrity integrity; + memset(&integrity, 0, sizeof(integrity)); switch (ns->pi_type) { case NVME_NS_DPS_PI_TYPE3: integrity.profile = &t10_pi_type3_crc;